diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-11-27 14:37:07 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-12-02 18:25:28 +0000 |
commit | 96cc7fe5c26e2b2fb3e49813ff9beadd38ef5992 (patch) | |
tree | dfc8d7cab5edbcad0c352b36e3f79a18e98755fe /src/plugins/platforms/windows/qwindowsfontengine.cpp | |
parent | d6b9ae201b6473de680a75079978203cfcc60126 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontengine.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontengine.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 3685197430..4a799af44e 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -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 |