From: Jiang Jiang Date: Wed, 8 Feb 2012 16:28:13 +0000 (+0100) Subject: Preserve weight and style request for multi font engines X-Git-Tag: qt-v5.0.0-alpha1~1198 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4af285c7d1be43b1882fb5b2ece8539622ea1b22;p=profile%2Fivi%2Fqtbase.git Preserve weight and style request for multi font engines So that fallback fonts can pickup the weight/style requested instead of using the weight and style of the primary font. Change-Id: Ia592e079cad61334f21e0453412b198a900bb6b6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 3ef28b8..e9b7d1a 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -724,7 +724,7 @@ static void match(int script, const QFontDef &request, const QString &family_name, const QString &foundry_name, int force_encoding_id, QtFontDesc *desc, const QList &blacklistedFamilies = QList(), bool forceXLFD=false); -static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef) +static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi) { fontDef->family = desc.family->name; if (! desc.foundry->name.isEmpty() && desc.family->count > 1) { @@ -743,8 +743,10 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe fontDef->styleHint = request.styleHint; fontDef->styleStrategy = request.styleStrategy; - fontDef->weight = desc.style->key.weight; - fontDef->style = desc.style->key.style; + if (!multi) + fontDef->weight = desc.style->key.weight; + if (!multi) + fontDef->style = desc.style->key.style; fontDef->fixedPitch = desc.family->fixedPitch; fontDef->stretch = desc.style->key.stretch; fontDef->ignorePitch = false; diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index c57fe4b..266ad4d 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -278,7 +278,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, } if (engine && engine->type() != QFontEngine::TestFontEngine) { - initFontDef(desc, request, &engine->fontDef); + initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi); if (fp) { QFontDef def = request; @@ -305,7 +305,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, } engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size); if (engine) { - initFontDef(desc, def, &engine->fontDef); + initFontDef(desc, def, &engine->fontDef, engine->type() == QFontEngine::Multi); } } }