path: root/src
diff options
authorTor Arne Vestbø <>2018-02-05 13:41:37 +0100
committerTor Arne Vestbø <>2018-02-07 10:41:12 +0000
commitefd5d7a837e7aa51ec64d9636932c0c83189f399 (patch)
tree74e3a8edfd83ec5cb9f643a5bfdac9af090ed9f3 /src
parentfef6b31b994befac0ee14391572ebc2b9b33e104 (diff)
CoreText: Make sure to keep reference to data when cloning raw font engine
QFontEngine::cloneWithSize() is used by QRawFont internally when switching a raw-font from one size to another using setPixelSize. For CoreText, we use a subclass of QCoreTextFontEngine to keep track of the QByteArray data of a raw-font, but failed to overload cloneWithSize, so we would lose the data whenever setPixelSize was called, resulting in missing text rendering in QtWebKit. We now retain the data as we should. Task-number: QTBUG-65923 Change-Id: I7d4186a3c32a61d48d1e9388e43f2792e8e46081 Reviewed-by: Eskil Abrahamsen Blomfeldt <>
Diffstat (limited to 'src')
2 files changed, 9 insertions, 1 deletions
diff --git a/src/platformsupport/fontdatabases/mac/ b/src/platformsupport/fontdatabases/mac/
index 66baf162d9..d96158d8f6 100644
--- a/src/platformsupport/fontdatabases/mac/
+++ b/src/platformsupport/fontdatabases/mac/
@@ -192,6 +192,14 @@ public:
: QCoreTextFontEngine(font, def)
, m_fontData(fontData)
+ QFontEngine *cloneWithSize(qreal pixelSize) const
+ {
+ QFontDef newFontDef = fontDef;
+ newFontDef.pixelSize = pixelSize;
+ newFontDef.pointSize = pixelSize * 72.0 / qt_defaultDpi();
+ return new QCoreTextRawFontEngine(cgFont, newFontDef, m_fontData);
+ }
QByteArray m_fontData;
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 2986f0aaec..d4c5e70cc1 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -125,7 +125,7 @@ public:
static QFontEngine::GlyphFormat defaultGlyphFormat;
static QCoreTextFontEngine *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
void init();
QImage imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool colorful, const QTransform &m);
CTFontRef ctfont;