tags:

views:

517

answers:

2

Why does Qt on OSX appear to default to overly large fonts? Even when you select the same font size manually the fonts appear slightly bigger. Does Qt on OSX use a different font rendering to OSX? Does this improve if you use Qt for Cocoa?

In addition, is there a qtconfig tool or equivalent to globally set the font settings for all Qt applications?

Thanks!

A: 

Why does Qt on OSX appear to default to overly large fonts?

It defaults to the same fonts in InterfaceBuilder and Qt Designer.

Even when you select the same font size manually the fonts appear slightly bigger.

Turns out this was just my imagination, they are exactly the same.

Does Qt on OSX use a different font rendering to OSX?

No, it uses the native rendering.

Does this improve if you use Qt for Cocoa?

Font's don't but other things do change. The font rendering between Carbon and Cocoa is seemingly identical.

In addition, is there a qtconfig tool or equivalent to globally set the font settings for all Qt applications?

There's no qtconfig tool for OSX or any way of globally setting font settings.

It seems the root of the above problems is that OSX applications tend to use slightly lower point fonts for many things compared to Windows or Linux. As a result the font sizes used in an Qt OSX application should be hand-tweaked to better match those use elsewhere on the platform.

Mike McQuaid
You can set the Qt::MacSmallSize and Qt::MacMiniSize widget attributes to render those the standard Mac smaller sizes.
Max Howell
Better yet, don't attempt to pass off a Qt port as a Mac program. Go native, or don't bother.
NSResponder
Better yet, don't troll questions. There are lots of good reasons for "passing off a Qt port". Sometimes there are Qt applications that are available on Windows and don't have equivalents on Mac and there isn't the time to implement a new front-end from scratch. Tweaking Qt applications means these applications actually make their way to Mac rather than being Windows-only.
Mike McQuaid
+1  A: 

Max Howell is correct. In native OS X applications, you have got the option to set small and tiny sizes to your windows and widgets. These will then choose smaller fonts and also will resize some of the graphical elements.

Many OS X designers make use of this, and therefore an application which does not follow this conventions is very likely to look oversized on OS X.

As has been noted, Qt does provide widget attributes which can change this: Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, Qt::WA_MacMiniSize, Qt::WA_MacVariableSize – but unfortunately, it seems that many people don’t know about them and if they do, implementing them is a bit of a hack, as it will require the code to have quite a few #ifdefs (unless they’re using a helper function for this to reduce the effort).

Particularly bad is that Qt does not use these attributes in their own Qt Creator or Qt Designer either, especially in widgets such as the property tables where the large row height makes it almost useless on smaller monitors, because you’ll need to scroll forever to find the property you’ve been looking for.

Debilski