diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-10-21 11:31:07 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-10-21 11:31:07 (GMT) |
commit | 3be273fc751624fab078878904ad3cb483cd141f (patch) | |
tree | 506e72bee69821db1c9ec7fc2bdf4ece23abf3e5 /src/gui/kernel/qapplication_mac.mm | |
parent | 84cfe9af5e333872ac67368a6b14c377ceeda8ec (diff) | |
download | Qt-3be273fc751624fab078878904ad3cb483cd141f.zip Qt-3be273fc751624fab078878904ad3cb483cd141f.tar.gz Qt-3be273fc751624fab078878904ad3cb483cd141f.tar.bz2 |
Properly detect font smoothing setting on Mac OS X in raster engine
We would assume font smoothing on the mac was always turned on, giving
poor text rendering in the cases where it was not. This implementation
mirrors querying the cleartype setting on Windows, checking the setting
on application initialization and rendering into an 8 bit cache if it
is turned off.
Task-number: QTBUG-4881
Reviewed-by: Morten Johan Sørvig
Diffstat (limited to 'src/gui/kernel/qapplication_mac.mm')
-rw-r--r-- | src/gui/kernel/qapplication_mac.mm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index f9c8aa3..771cddc 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -203,6 +203,8 @@ static EventHandlerRef tablet_proximity_handler = 0; static EventHandlerUPP tablet_proximity_UPP = 0; bool QApplicationPrivate::native_modal_dialog_active; +Q_GUI_EXPORT bool qt_applefontsmoothing_enabled; + /***************************************************************************** External functions *****************************************************************************/ @@ -222,6 +224,12 @@ extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); // qapplicatio void onApplicationWindowChangedActivation( QWidget*widget, bool activated ); void onApplicationChangedActivation( bool activated ); +static void qt_mac_read_fontsmoothing_settings() +{ + NSInteger appleFontSmoothing = [[NSUserDefaults standardUserDefaults] integerForKey:@"AppleFontSmoothing"]; + qt_applefontsmoothing_enabled = (appleFontSmoothing > 0); +} + Q_GUI_EXPORT bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret) { OSStatus err; AEDesc scriptTextDesc; @@ -1203,6 +1211,9 @@ void qt_init(QApplicationPrivate *priv, int) } if (QApplication::desktopSettingsAware()) QApplicationPrivate::qt_mac_apply_settings(); + + qt_mac_read_fontsmoothing_settings(); + // Cocoa application delegate #ifdef QT_MAC_USE_COCOA NSApplication *cocoaApp = [NSApplication sharedApplication]; |