Fonts on Mac vs Windows



  • Hello,

    I've ported my app from Mac to Windows. We use Designer to lay out our ui elements. On Windows, I run through each widget at run time and reduce the fontsize by the dpi ratio of 72/96.

    For the most part, this does a good job where text length is not critical, but for some areas, the QLabels are too long and running into other widgets. It appears that the spacing between chars is different.

    I'm using verdana. Are their any fonts that are identical on both platforms? Commercial fonts would be ok.

    Our app requires precise placement of labels on a png background, so I've got to get the font size and spacing right.

    Thanks for your thoughts.



  • Hi, this is going to be almost impossible to guarantee. Fonts are different in spacing between Mac and Windows, and even the same fonts are rendered differently at times. You can use heuristics to find a matching font (aka as trial-and-error), or use scalable backgrounds, for example SVGs, and scale according to the font.



  • Thanks, then I'll have to find another solution. The problems I was having were in areas that require right alignment. I'll specify right alignment, now, and not care if the left edge moves over a little.



  • You could embed a font in your application's resource (if you got the font license to do that) and dynamically add the font ressource to the font database of the application. Maybe that helps to have the same look on windows and mac.

    ( see "http://developer.qt.nokia.com/doc/qt-4.8/qfontdatabase.html#addApplicationFontFromData":http://developer.qt.nokia.com/doc/qt-4.8/qfontdatabase.html#addApplicationFontFromData )


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.