diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-10-27 11:00:35 +0100 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-11-16 14:33:23 +0000 |
commit | a856c4a902816a7d691ca50e6f556521287be441 (patch) | |
tree | 16c85444c883ea625021a13892447285f701a9c1 /src/gui/text | |
parent | 96cebb46c2e9b74ea119b8ed13896f012bea496e (diff) |
Fix falsely reported style for fallback font
In change 8f6b3284106fa11129e4fa6e5ec3adc6cb1f489f we override
the fontDef of the fallback font with the fontDef of the
original font (with the family name replaced) to fix a
regression where boldness was not inherited by the fallback
font.
This caused a bug, though, since the contents of the fontDef
would now misrepresent the actual font used. The side effect
of this was that isSmoothlyScalable() returned false because
the family and styleName combination we claim to have did
not exist in the font database. Result: We fell back to
native rendering for the font even though it's scalable.
Weight and style are the only parts that should be inherited,
since they are synthesized. So rather than overwriting
the fontDef completely, we copy the weight and style when
needed.
The bug in QTBUG-42963 is still fixed after this change.
[ChangeLog][Text] Fixed problem where fallback fonts for text
with certain styles would be reported as unscalable.
Change-Id: I95ef67f818852aea5a6ae8df789a52364ecb59a6
Task-number: QTBUG-47547
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 3208a199b7..f267b2d147 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1835,7 +1835,10 @@ QFontEngine *QFontEngineMulti::loadEngine(int at) request.family = fallbackFamilyAt(at - 1); if (QFontEngine *engine = QFontDatabase::findFont(request, m_script)) { - engine->fontDef = request; + if (request.weight > QFont::Normal) + engine->fontDef.weight = request.weight; + if (request.style > QFont::StyleNormal) + engine->fontDef.style = request.style; return engine; } |