From 8306dee38f4e315399a465b028819b0777746c55 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 6 Aug 2014 13:40:46 +0200 Subject: Windows: Fix stored family name of fallback fonts When we create fallback fonts, we copy the fontdef of the main font, but we need to update the family name to match reality, otherwise a QRawFont created with the font engine will have the wrong family name. This is already done in the default implementation of loadEngine(), but was missing from the Windows implementation. One large consequence of this was that when the distance field renderer cloned the font engine (to change its size), it would clone it with the wrong family name. When it later painted its glyph indexes, they would of course refer to the wrong font (the fallback) so random characters would appear. [ChangeLog][Windows] Fixed using QRawFont with fallback fonts, e.g. in the case of text rendering in Qt Quick. Task-number: QTBUG-39172 Change-Id: Ic8fcd9dfc20ec7aadf0b47d4a80417f401f355fd Reviewed-by: Konstantin Ritt --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 6f97c8584b..4efedb7bc7 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1350,6 +1350,7 @@ void QWindowsMultiFontEngine::loadEngine(int at) fontEngine->fontDef.pixelSize, data); fedw->fontDef = fontDef; + fedw->fontDef.family = fam; fedw->ref.ref(); engines[at] = fedw; @@ -1375,6 +1376,7 @@ void QWindowsMultiFontEngine::loadEngine(int at) engines[at] = new QWindowsFontEngine(fam, hfont, stockFont, lf, data); engines[at]->ref.ref(); engines[at]->fontDef = fontDef; + engines[at]->fontDef.family = fam; qCDebug(lcQpaFonts) << __FUNCTION__ << at << fam; // TODO: increase cost in QFontCache for the font engine loaded here -- cgit v1.2.3