Windows: Improve Freetype font database registry check for fonts

Some non-scalable fonts like "Courier" list some numbers after the font
name in Windows registry, e.g. "Courier 10,12,15". These are not part
of the font name and therefore confused the algorithm looking for font
files. Improved the algorithm to ignore this kind of number list.
Single numbers are still expected to be part of the font name.

Task-number: QTBUG-24970
Change-Id: I3fe45b798f44bee962e5b3aa748fc4717f723353
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
This commit is contained in:
Miikka Heikkinen 2012-03-30 14:51:42 +03:00 committed by Qt by Nokia
parent db347ec2f8
commit 108e708e70

View File

@ -195,9 +195,11 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
const QStringList allKeys = fontRegistry.allKeys(); const QStringList allKeys = fontRegistry.allKeys();
allFonts.reserve(allKeys.size()); allFonts.reserve(allKeys.size());
const QString trueType = QStringLiteral("(TrueType)"); const QString trueType = QStringLiteral("(TrueType)");
const QRegExp sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+"));
foreach (const QString &key, allKeys) { foreach (const QString &key, allKeys) {
QString realKey = key; QString realKey = key;
realKey.remove(trueType); realKey.remove(trueType);
realKey.remove(sizeListMatch);
QStringList fonts; QStringList fonts;
const QStringList fontNames = realKey.trimmed().split(QLatin1Char('&')); const QStringList fontNames = realKey.trimmed().split(QLatin1Char('&'));
foreach (const QString &fontName, fontNames) foreach (const QString &fontName, fontNames)