From a856c4a902816a7d691ca50e6f556521287be441 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 27 Oct 2015 11:00:35 +0100 Subject: [PATCH] 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 Reviewed-by: Konstantin Ritt --- src/gui/text/qfontengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; }