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 <eskil.abrahamsen-blomfeldt@nokia.com>
bb10
Jiang Jiang 2012-02-08 17:28:13 +01:00 committed by Qt by Nokia
parent 581f079b04
commit 4af285c7d1
2 changed files with 7 additions and 5 deletions

View File

@ -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<int> &blacklistedFamilies = QList<int>(), 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;

View File

@ -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);
}
}
}