Make font fallback list for common script locale aware
Even in common script we may need to have a preferred font list (which font should be used for CJK codepoints, Chinese, Japanese or Korean? Since the codepoints they cover may overlap.) Adding current default language into the pattern in that case will give a better recommendation for the fallback list if the system have configuration files like that. Change-Id: Idbc7f7b0cf24108d6cc255a1add0b29b730588c0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>bb10
parent
6615363e58
commit
28dd6eda7b
|
|
@ -627,6 +627,19 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const
|
|||
FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]);
|
||||
FcPatternAddLangSet(pattern, FC_LANG, ls);
|
||||
FcLangSetDestroy(ls);
|
||||
} else if (!family.isEmpty()) {
|
||||
// If script is common 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)
|
||||
FcPattern *dummy = FcPatternCreate();
|
||||
FcDefaultSubstitute(dummy);
|
||||
FcChar8 *lang = 0;
|
||||
FcResult res = FcPatternGetString(dummy, FC_LANG, 0, &lang);
|
||||
if (res == FcResultMatch)
|
||||
FcPatternAddString(pattern, FC_LANG, lang);
|
||||
FcPatternDestroy(dummy);
|
||||
}
|
||||
|
||||
const char *stylehint = getFcFamilyForStyleHint(styleHint);
|
||||
|
|
|
|||
Loading…
Reference in New Issue