Enable subpixel rendering for raster on Mac

Change-Id: I06e6465e03c17776974d361254abf5b750736080
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
Jiang Jiang 2011-12-01 11:21:28 +01:00 committed by Qt by Nokia
parent 7d2ab7f01d
commit 6887a7e395
2 changed files with 11 additions and 1 deletions

View File

@ -88,6 +88,7 @@ inline QString qt_mac_NSStringToQString(const NSString *nsstr)
{ return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); }
int qt_antialiasing_threshold = 0;
bool qt_enable_font_smoothing = true;
QFont::StyleHint styleHintFromNSString(NSString *style)
{
@ -123,6 +124,12 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold"));
if (appleValue.isValid())
qt_antialiasing_threshold = appleValue.toInt();
appleValue = appleSettings.value(QLatin1String("AppleFontSmoothing"));
// Only disable font smoothing when AppleFontSmoothing is set to 0,
// empty or non-zero means enabled
if (appleValue.isValid() && appleValue.toInt() == 0)
qt_enable_font_smoothing = false;
}
QCoreTextFontDatabase::~QCoreTextFontDatabase()

View File

@ -400,7 +400,7 @@ void QCoreTextFontEngineMulti::loadEngine(int)
Q_ASSERT(false);
}
extern int qt_antialiasing_threshold; // from qapplication.cpp
extern int qt_antialiasing_threshold, qt_enable_font_smoothing;
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef)
{
@ -470,6 +470,9 @@ void QCoreTextFontEngine::init()
Q_ASSERT(ctfont != NULL);
Q_ASSERT(cgFont != NULL);
glyphFormat = qt_enable_font_smoothing ? QFontEngineGlyphCache::Raster_RGBMask
: QFontEngineGlyphCache::Raster_A8;
QCFString family = CTFontCopyFamilyName(ctfont);
fontDef.family = family;