QFontConfigDatabase: fix fallbacksForFamily() for CJK languages
For Han Unicode script, the language couldn't be determined algorithmically, the only way is guessing based on the user's locale. The is a regression introduced in 9b0fab6b62df98519ebfab117f14b9d3465d8c68 Change-Id: I84645885a825fdfb6c268edaf10185bf5e447eb5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
f0af3ed4e5
commit
0fcadcca3d
@ -134,8 +134,8 @@ static const char *specialLanguages[] = {
|
||||
"mn", // Mongolian
|
||||
"ja", // Hiragana
|
||||
"ja", // Katakana
|
||||
"zh", // Bopomofo
|
||||
"zh", // Han
|
||||
"zh-TW", // Bopomofo
|
||||
"", // Han
|
||||
"ii", // Yi
|
||||
"ett", // OldItalic
|
||||
"got", // Gothic
|
||||
@ -697,11 +697,11 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont
|
||||
FcPatternAddLangSet(pattern, FC_LANG, ls);
|
||||
FcLangSetDestroy(ls);
|
||||
} else if (!family.isEmpty()) {
|
||||
// If script is common then it may include languages like CJK,
|
||||
// If script is Common or Han, then it may include languages like CJK,
|
||||
// we should attach system default language set to the pattern
|
||||
// to obtain correct font fallback list (i.e. if LANG=zh_CN
|
||||
// then we normally want to use a Chinese font for CJK text;
|
||||
// while a Japanese font should be use for that if LANG=ja)
|
||||
// while a Japanese font should be used for that if LANG=ja)
|
||||
FcPattern *dummy = FcPatternCreate();
|
||||
FcDefaultSubstitute(dummy);
|
||||
FcChar8 *lang = 0;
|
||||
|
@ -1790,7 +1790,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ
|
||||
directWriteFont->Release();
|
||||
#endif
|
||||
|
||||
if (script == QChar::Script_Common
|
||||
if ((script == QChar::Script_Common || script == QChar::Script_Han)
|
||||
&& !(request.styleStrategy & QFont::NoFontMerging)) {
|
||||
QStringList extraFonts = extraTryFontsForFamily(request.family);
|
||||
if (extraFonts.size()) {
|
||||
|
@ -432,7 +432,7 @@ static const char **tryFonts = 0;
|
||||
|
||||
QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
|
||||
{
|
||||
if (script == QChar::Script_Common) {
|
||||
if (script == QChar::Script_Common || script == QChar::Script_Han) {
|
||||
// && !(request.styleStrategy & QFont::NoFontMerging)) {
|
||||
QFontDatabase db;
|
||||
if (!db.writingSystems(family).contains(QFontDatabase::Symbol)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user