[Qt-interest] Default application Font
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Thu Jan 29 14:50:41 CET 2009
Jon Flowers wrote on Thursday, January 29, 2009 2:19 PM:
> ... So I guess how do I deploy the
> application to work and look as expected on any machine?
Define "expected": for example you can *not* assume that a given target machine has the very font installed which you set as "expected default font". Even if you request "Arial" the system might have a "Microsoft Arial" installed - or "Adobe Arial". Or it might even come up with an "Apple Helvetica" font instead. Not to mention that the rendering could be slightly different for each of those fonts: different kerning, different letter sizes etc. can easily lead to different line-breaks, for example.
So the best method is: DON'T ASSUME that the user's font behaves as on your development machine! Don't even assume that the user has the same font installed (but hopefully a "similar" font).
The underlying font rendering system (which off course can even vary betwenn Linux distros, due to different FreeType (?) library versions, for example) does the "font matching", which can be quite complex (and off course can also be "overriden" by user-settings. For example the user could define "replacement fonts" etc.).
But also on Windows, on the other hand, you'll encounter the "Large Fonts" vs. "Normal Fonts" issue (and yes, there ARE people with large screens, which prefer to read text without a lens ;)
How can you face this? DON'T ASSUME A FIXED SIZE (width/height) for any label, for any font and string (not to mention if you are going to translate your application).
Use the Qt layout management! DON"T MAKE FIXED SIZE DIALOGS (BAD, BAD, BAD!), as a typical MFC application would do! The Qt layout managers automatically adjust dialog sizes, given the "preferred/minimum/maximum" sizes of their child widgets.
If on the other hand you REALLY expect a font look exactly like yours on the development system, then you have to ship that particular font together with your application. And make sure that your application REALLY picks up that font (I have never done that, so I don't know how you change the font path for your app, but I know that it is possible. Not sure if there is a Qt API for that though...) Google Picasa 3 (a Qt application!) does that (see the "runtime" subdirectory), as well as Adobe PDF Reader (which comes with a standard set of fonts, and/or uses the EMBEDDED fonts in the PDF document).
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list