DirectWrite: Inherit synthesized properties for fallback fonts

When a fallback font is selected, we need to copy out the
properties from the main font which can be synthesized
by the font engine. In particular, this is weight > normal,
and oblique style.

This is the DirectWrite equivalent of
a856c4a902816a7d691ca50e6f556521287be441.

Change-Id: I5d1215c66a433c8a8029c06e7a3dcee287f3f76f
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2015-11-27 14:37:07 +01:00
parent d6b9ae201b
commit 96cc7fe5c2

View File

@ -1357,6 +1357,11 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at)
QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace,
fontEngine->fontDef.pixelSize,
data);
if (fontEngine->fontDef.weight > QFont::Normal)
fedw->fontDef.weight = fontEngine->fontDef.weight;
if (fontEngine->fontDef.style > QFont::StyleNormal)
fedw->fontDef.style = fontEngine->fontDef.style;
fedw->fontDef.family = fam;
return fedw;
} else {
qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__);
@ -1368,7 +1373,13 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at)
// Get here if original font is not DirectWrite or DirectWrite creation failed for some
// reason
return new QWindowsFontEngine(fam, lf, data);
QFontEngine *fe = new QWindowsFontEngine(fam, lf, data);
if (fontEngine->fontDef.weight > QFont::Normal)
fe->fontDef.weight = fontEngine->fontDef.weight;
if (fontEngine->fontDef.style > QFont::StyleNormal)
fe->fontDef.style = fontEngine->fontDef.style;
fe->fontDef.family = fam;
return fe;
}
bool QWindowsFontEngine::supportsTransformation(const QTransform &transform) const