diff options
Diffstat (limited to 'src/platformsupport/fontdatabases')
-rw-r--r-- | src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 13 | ||||
-rw-r--r-- | src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h | 15 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 1087d18891..4923950c13 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -149,8 +149,6 @@ void QCoreTextFontEngine::init() Q_ASSERT(ctfont != NULL); Q_ASSERT(cgFont != NULL); - glyphFormat = defaultGlyphFormat; - QCFString family = CTFontCopyFamilyName(ctfont); fontDef.family = family; @@ -159,6 +157,14 @@ void QCoreTextFontEngine::init() synthesisFlags = 0; CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont); + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 + if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait)) + glyphFormat = QFontEngineGlyphCache::Raster_ARGB; + else +#endif + glyphFormat = defaultGlyphFormat; + if (traits & kCTFontItalicTrait) fontDef.style = QFont::StyleItalic; @@ -422,6 +428,9 @@ static void convertCGPathToQPainterPath(void *info, const CGPathElement *element void QCoreTextFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs, QPainterPath *path, QTextItem::RenderFlags) { + if (glyphFormat == QFontEngineGlyphCache::Raster_ARGB) + return; // We can't convert color-glyphs to path + CGAffineTransform cgMatrix = CGAffineTransformIdentity; cgMatrix = CGAffineTransformScale(cgMatrix, 1, -1); diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 6c5c557b13..b3a0968c4b 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -108,6 +108,21 @@ public: virtual QFontEngine *cloneWithSize(qreal pixelSize) const; virtual int glyphMargin(QFontEngineGlyphCache::Type type) { Q_UNUSED(type); return 0; } + static bool supportsColorGlyphs() + { +#if defined(Q_OS_IOS) + return true; +#elif MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 + #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + return &CTFontDrawGlyphs; + #else + return true; + #endif +#else + return false; +#endif + } + static int antialiasingThreshold; static QFontEngineGlyphCache::Type defaultGlyphFormat; |