Results 1 to 4 of 4

Thread: Large fonts on Linux and Solaris

  1. #1
    Join Date
    Jun 2009
    Posts
    66
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Large fonts on Linux and Solaris

    Hi All,

    My app, which runs on Windows, Linux and Solaris, has normal size fonts in Windows, but the fonts in Linux and Solaris are too big.

    On my development system, I run qtconfig and reduce the size of the fonts to a more acceptable level.

    However, when deploying the software, what should I do? Since customers will not be able to make this change, unless I deploy qtconfig with my app.

    Any ideas?

    I'm wondering whether this is a way of embedding the fonts into the app, or something like that. I've had a search around this subject, but now found anything yet.

    cheers,

    David

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Large fonts on Linux and Solaris

    Hi David,

    I am not sure if this may help you, since I never had to deal with it my self, but, I think if you work with point size and not pixel size you can have a better control of how the fonts will look on any given display, since you the size is then defined by the dpi of the screen, so it should offer you some platform independence with the font size.
    Have a look in the QFont documentation text.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2009
    Posts
    66
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Large fonts on Linux and Solaris

    Hey High_Flyer,

    Thanks for pointing me towards the settings in QFont. I've put the following code at the start of my app :-

    Qt Code:
    1. QApplication app(argc, argv);
    2.  
    3. // Set the font size for solaris and linux
    4. int DefaultFontSize = 0;
    5.  
    6. #ifdef __linux__
    7. DefaultFontSize = 8;
    8. #else if __sun
    9. DefaultFontSize = 11;
    10. #endif
    11.  
    12. // There is no need to set the font size on Windows
    13. #ifndef WIN32
    14. QFont AppFont = app.font();
    15. AppFont.setPointSize(DefaultFontSize);
    16. app.setFont(AppFont);
    17. #endif
    To copy to clipboard, switch view to plain text mode 

    This sets the size of the font on linux and solaris at 8pt and 11pt, which on my system look the size i want. I'm going to test on other systems, but it looks like this does exactly what I want

    David

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Large fonts on Linux and Solaris

    Great!
    Hope this solved your problem.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.