From 527406cbd99f44470ef87468b73c18df949e8ac7 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 12 Nov 2018 09:40:47 +0100 Subject: Modernize the "settings" feature Change-Id: I9b8a61ecb1413b513ae5c9e77d3ee1b3e8b6562c Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 18 ++++++++++++------ .../fontdatabases/mac/qfontengine_coretext.mm | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/platformsupport/fontdatabases/mac') diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 91c2dc8cf0..898432e602 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -50,7 +50,9 @@ #include "qcoretextfontdatabase_p.h" #include "qfontengine_coretext_p.h" +#if QT_CONFIG(settings) #include +#endif #include #ifndef QT_NO_FREETYPE #include @@ -116,21 +118,25 @@ QCoreTextFontDatabase::QCoreTextFontDatabase() : m_hasPopulatedAliases(false) { #ifdef Q_OS_MACX - QSettings appleSettings(QLatin1String("apple.com")); - QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold")); - if (appleValue.isValid()) - QCoreTextFontEngine::antialiasingThreshold = appleValue.toInt(); - /* font_smoothing = 0 means no smoothing, while 1-3 means subpixel antialiasing with different hinting styles (but we don't care about the exact value, only if subpixel rendering is available or not) */ int font_smoothing = 0; + +#if QT_CONFIG(settings) + QSettings appleSettings(QLatin1String("apple.com")); + QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold")); + if (appleValue.isValid()) + QCoreTextFontEngine::antialiasingThreshold = appleValue.toInt(); + appleValue = appleSettings.value(QLatin1String("AppleFontSmoothing")); if (appleValue.isValid()) { font_smoothing = appleValue.toInt(); - } else { + } else +#endif // settings + { // non-Apple displays do not provide enough information about subpixel rendering so // draw text with cocoa and compare pixel colors to see if subpixel rendering is enabled int w = 10; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 98b753eff9..57ae622891 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -41,7 +41,9 @@ #include #include +#if QT_CONFIG(settings) #include +#endif #include -- cgit v1.2.3