Fix font merging for complex scripts on Windows

As long as QWindowsFontDatabase::fallbacksForFamily() does not take script
parameter into account, we should prefer QFontEngineMultiQPA's loadEngine()
implementation for complex scripts; otherwise we could fall into a situation
where reported fallback fonts doesn't support the requested script at all.

This finishes c3b2425791.

Task-number: QTBUG-37836
Change-Id: I2c43d97f1331ad05116856f9fe77560ed4dd02c7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Konstantin Ritt 2014-04-12 03:45:28 +03:00 committed by The Qt Project
parent c99f909bed
commit fec19027a5
2 changed files with 7 additions and 5 deletions

View File

@ -1040,7 +1040,11 @@ QWindowsFontDatabase::~QWindowsFontDatabase()
QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script)
{ {
return new QWindowsMultiFontEngine(fontEngine, script); if (script == QChar::Script_Common)
return new QWindowsMultiFontEngine(fontEngine, script);
// ### as long as fallbacksForFamily() does not take script parameter into account,
// prefer QFontEngineMultiQPA's loadEngine() implementation for complex scripts
return QPlatformFontDatabase::fontEngineMulti(fontEngine, script);
} }
QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle)
@ -1619,8 +1623,7 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon
result << QString::fromLatin1("Arial"); result << QString::fromLatin1("Arial");
} }
if (script == QChar::Script_Common || script == QChar::Script_Han) result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
<< script << result << m_families.size(); << script << result << m_families.size();

View File

@ -477,8 +477,7 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF
} }
#endif #endif
if (script == QChar::Script_Common || script == QChar::Script_Han) result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
<< script << result << m_families; << script << result << m_families;