From 108e708e7068bcd402c7f3202e76ab2c2ebd9a68 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 30 Mar 2012 14:51:42 +0300 Subject: 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 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 500a1eeccb..e84f0c7630 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -195,9 +195,11 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, const QStringList allKeys = fontRegistry.allKeys(); allFonts.reserve(allKeys.size()); const QString trueType = QStringLiteral("(TrueType)"); + const QRegExp sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+")); foreach (const QString &key, allKeys) { QString realKey = key; realKey.remove(trueType); + realKey.remove(sizeListMatch); QStringList fonts; const QStringList fontNames = realKey.trimmed().split(QLatin1Char('&')); foreach (const QString &fontName, fontNames) -- cgit v1.2.3