diff --git a/src/gui/text/windows/qwindowsfontdatabase.cpp b/src/gui/text/windows/qwindowsfontdatabase.cpp index 58ff99e3a8..c89039ac58 100644 --- a/src/gui/text/windows/qwindowsfontdatabase.cpp +++ b/src/gui/text/windows/qwindowsfontdatabase.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -499,7 +500,7 @@ namespace { {} QString populatedFontFamily; - QSet foundFontAndStyles; + QDuplicateTracker foundFontAndStyles; QWindowsFontDatabase *windowsFontDatabase; }; } @@ -642,10 +643,8 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t signature = &reinterpret_cast(textmetric)->ntmFontSig; // We get a callback for each script-type supported, but we register them all // at once using the signature, so we only need one call to addFontToDatabase(). - FontAndStyle fontAndStyle = {familyName, styleName}; - if (sfp->foundFontAndStyles.contains(fontAndStyle)) + if (sfp->foundFontAndStyles.hasSeen({familyName, styleName})) return 1; - sfp->foundFontAndStyles.insert(fontAndStyle); } addFontToDatabase(familyName, styleName, *logFont, textmetric, signature, type, sfp); diff --git a/src/gui/text/windows/qwindowsfontdatabase_ft.cpp b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp index e2c8d3455d..b149701de5 100644 --- a/src/gui/text/windows/qwindowsfontdatabase_ft.cpp +++ b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp @@ -51,6 +51,8 @@ #if QT_CONFIG(regularexpression) #include #endif +#include + #include #include @@ -318,11 +320,9 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t signature = &reinterpret_cast(textmetric)->ntmFontSig; // We get a callback for each script-type supported, but we register them all // at once using the signature, so we only need one call to addFontToDatabase(). - QSet *foundFontAndStyles = reinterpret_cast *>(lparam); - FontAndStyle fontAndStyle = {faceName, styleName}; - if (foundFontAndStyles->contains(fontAndStyle)) + auto foundFontAndStyles = reinterpret_cast *>(lparam); + if (foundFontAndStyles->hasSeen({faceName, styleName})) return 1; - foundFontAndStyles->insert(fontAndStyle); } addFontToDatabase(faceName, styleName, fullName, *logFont, textmetric, signature, type); @@ -352,7 +352,7 @@ void QWindowsFontDatabaseFT::populateFamily(const QString &familyName) lf.lfFaceName[familyName.size()] = 0; lf.lfCharSet = DEFAULT_CHARSET; lf.lfPitchAndFamily = 0; - QSet foundFontAndStyles; + QDuplicateTracker foundFontAndStyles; EnumFontFamiliesEx(dummy, &lf, storeFont, reinterpret_cast(&foundFontAndStyles), 0); ReleaseDC(0, dummy); }