From 1161a8a62907796ea45b1877bec31e66aeef77f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 15 Jan 2013 14:09:18 +0100 Subject: CoreText: Add support for providing scaled glyphs to the glyph-cache Useful for not having to fall back to QPainterPath drawing when using the raster engine with a retina screen (which has a 2x scale). Change-Id: I0a9f754d31b0ecd8e8daf7a01331d19716bab680 Reviewed-by: Gunnar Sletta --- .../fontdatabases/mac/qfontengine_coretext.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm') diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index ace4c982fd..961b28961c 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -508,7 +508,15 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) { - QImage im = imageForGlyph(glyph, subPixelPosition, false, QTransform()); + return alphaMapForGlyph(glyph, subPixelPosition, QTransform()); +} + +QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &x) +{ + if (x.type() > QTransform::TxScale) + return QFontEngine::alphaMapForGlyph(glyph, subPixelPosition, x); + + QImage im = imageForGlyph(glyph, subPixelPosition, false, x); QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); QVector colors(256); @@ -602,7 +610,7 @@ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) const { - return transform.type() <= QTransform::TxTranslate; + return transform.type() <= QTransform::TxScale; } QT_END_NAMESPACE -- cgit v1.2.3