Fix for fontconfig 2.9 behavior change
Start from 2.9, fontconfig will reset the result to FcResultNoMatch at the beginning of FcFontSort(). According to http://lists.freedesktop.org/archives/fontconfig/2012-March/003857.html the result value of FcFontSort() can be ignored, checking the nfont value of the fontset returned is sufficient. The fix works for pre-2.9 versions as well, since those versions don't touch the result at all. Change-Id: Iba6c1157e314088a90867292a4bd970bb873e284 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
parent
cb33c3b2b6
commit
3c3c445daf
@ -641,17 +641,15 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const
|
||||
FcPatternDestroy(pattern);
|
||||
|
||||
if (fontSet) {
|
||||
if (result == FcResultMatch) {
|
||||
for (int i = 0; i < fontSet->nfont; i++) {
|
||||
FcChar8 *value = 0;
|
||||
if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
|
||||
continue;
|
||||
// capitalize(value);
|
||||
QString familyName = QString::fromUtf8((const char *)value);
|
||||
if (!fallbackFamilies.contains(familyName,Qt::CaseInsensitive) &&
|
||||
familyName.compare(family, Qt::CaseInsensitive)) {
|
||||
fallbackFamilies << familyName;
|
||||
}
|
||||
for (int i = 0; i < fontSet->nfont; i++) {
|
||||
FcChar8 *value = 0;
|
||||
if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
|
||||
continue;
|
||||
// capitalize(value);
|
||||
QString familyName = QString::fromUtf8((const char *)value);
|
||||
if (!fallbackFamilies.contains(familyName,Qt::CaseInsensitive) &&
|
||||
familyName.compare(family, Qt::CaseInsensitive)) {
|
||||
fallbackFamilies << familyName;
|
||||
}
|
||||
}
|
||||
FcFontSetDestroy(fontSet);
|
||||
|
Loading…
Reference in New Issue
Block a user