QFontConfigDatabase: Fix performance regression

..introduced by 244cc5da55
Symbol fonts usually don't have code ranges support except Latin.
Don't load FT face for font that doesn't look like a symbol font.

Change-Id: Iec46aa84e27227e0bda5d50f96a2b2f75f58e950
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Konstantin Ritt 2013-04-15 21:22:33 +03:00 committed by The Qt Project
parent 8e127d9df8
commit 201bd2e59a

View File

@ -491,8 +491,22 @@ void QFontconfigDatabase::populateFontDatabase()
fontFile->fileName = QLatin1String((const char *)file_value);
fontFile->indexValue = indexValue;
if (isSymbolFont(fontFile))
writingSystems.setSupported(QFontDatabase::Other);
if (!writingSystems.supported(QFontDatabase::Symbol)) {
// Symbol encoding used to encode various crap in the 32..255 character
// code range, which belongs to Latin character code range.
// Symbol fonts usually don't have any other code ranges support.
bool mightBeSymbolFont = true;
for (int j = 2; j < QFontDatabase::WritingSystemsCount; ++j) {
if (writingSystems.supported(QFontDatabase::WritingSystem(j))) {
mightBeSymbolFont = false;
break;
}
}
if (mightBeSymbolFont && isSymbolFont(fontFile)) {
writingSystems.setSupported(QFontDatabase::Latin, false);
writingSystems.setSupported(QFontDatabase::Symbol);
}
}
QFont::Style style = (slant_value == FC_SLANT_ITALIC)
? QFont::StyleItalic