1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

DirectWrite: Return styles in the order reported by the system

This is more likely to place the regular/default style first in the list
of styles.
This commit is contained in:
reuk 2024-10-01 15:18:09 +01:00
parent 14dc97a29e
commit 27d877c175
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -153,12 +153,18 @@ public:
if (FAILED (collection->GetFontFamily (fontIndex, fontFamily.resetAndGetPointerAddress())) || fontFamily == nullptr)
continue;
std::set<String> results;
std::set<String> uniqueResults;
StringArray orderedResults;
for (const auto& font : getAllFontsInFamily (fontFamily))
results.insert (getFontFaceName (font));
{
const auto name = getFontFaceName (font);
return stringArrayFromRange (results);
if (uniqueResults.insert (name).second)
orderedResults.add (name);
}
return orderedResults;
}
return {};