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
|
"mn", // Mongolian
|
||||||
"ja", // Hiragana
|
"ja", // Hiragana
|
||||||
"ja", // Katakana
|
"ja", // Katakana
|
||||||
"zh", // Bopomofo
|
"zh-TW", // Bopomofo
|
||||||
"zh", // Han
|
"", // Han
|
||||||
"ii", // Yi
|
"ii", // Yi
|
||||||
"ett", // OldItalic
|
"ett", // OldItalic
|
||||||
"got", // Gothic
|
"got", // Gothic
|
||||||
@ -697,11 +697,11 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString &family, QFont
|
|||||||
FcPatternAddLangSet(pattern, FC_LANG, ls);
|
FcPatternAddLangSet(pattern, FC_LANG, ls);
|
||||||
FcLangSetDestroy(ls);
|
FcLangSetDestroy(ls);
|
||||||
} else if (!family.isEmpty()) {
|
} 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
|
// we should attach system default language set to the pattern
|
||||||
// to obtain correct font fallback list (i.e. if LANG=zh_CN
|
// to obtain correct font fallback list (i.e. if LANG=zh_CN
|
||||||
// then we normally want to use a Chinese font for CJK text;
|
// 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();
|
FcPattern *dummy = FcPatternCreate();
|
||||||
FcDefaultSubstitute(dummy);
|
FcDefaultSubstitute(dummy);
|
||||||
FcChar8 *lang = 0;
|
FcChar8 *lang = 0;
|
||||||
|
@ -1790,7 +1790,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ
|
|||||||
directWriteFont->Release();
|
directWriteFont->Release();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (script == QChar::Script_Common
|
if ((script == QChar::Script_Common || script == QChar::Script_Han)
|
||||||
&& !(request.styleStrategy & QFont::NoFontMerging)) {
|
&& !(request.styleStrategy & QFont::NoFontMerging)) {
|
||||||
QStringList extraFonts = extraTryFontsForFamily(request.family);
|
QStringList extraFonts = extraTryFontsForFamily(request.family);
|
||||||
if (extraFonts.size()) {
|
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
|
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)) {
|
// && !(request.styleStrategy & QFont::NoFontMerging)) {
|
||||||
QFontDatabase db;
|
QFontDatabase db;
|
||||||
if (!db.writingSystems(family).contains(QFontDatabase::Symbol)) {
|
if (!db.writingSystems(family).contains(QFontDatabase::Symbol)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user