Use EGL instead of GLX, and remove duplicate font names

This commit is contained in:
Yousef Khadadeh 2025-11-15 17:03:14 +03:00
parent 5e8016b504
commit e4efb2e78d
5 changed files with 32 additions and 14 deletions

View file

@ -10,15 +10,15 @@
bool GUIStuff::FontPicker::update(UpdateInputData& io, std::string* fontName, GUIManager* gui) {
if(sortedFontList.empty()) {
auto icu = SkUnicodes::ICU::Make();
std::set<std::string> sortedFontSet;
for(int i = 0; i < io.textFontMgrLocal->countFamilies(); i++) {
SkString familyNameSkString;
io.textFontMgrLocal->getFamilyName(i, &familyNameSkString);
if(familyNameSkString.isEmpty())
continue;
std::string familyName(familyNameSkString.c_str(), familyNameSkString.size());
sortedFontList.emplace_back(familyName);
std::transform(familyName.begin(), familyName.end(), familyName.begin(), ::tolower);
sortedFontListLowercase.emplace_back(familyName);
sortedFontSet.emplace(familyName);
}
for(int i = 0; i < io.textFontMgrFallback->countFamilies(); i++) {
SkString familyNameSkString;
@ -26,12 +26,12 @@ bool GUIStuff::FontPicker::update(UpdateInputData& io, std::string* fontName, GU
if(familyNameSkString.isEmpty())
continue;
std::string familyName(familyNameSkString.c_str(), familyNameSkString.size());
sortedFontList.emplace_back(familyName);
std::transform(familyName.begin(), familyName.end(), familyName.begin(), ::tolower);
sortedFontListLowercase.emplace_back(familyName);
sortedFontSet.emplace(familyName);
}
std::sort(sortedFontList.begin(), sortedFontList.end());
std::sort(sortedFontListLowercase.begin(), sortedFontListLowercase.end());
sortedFontList = std::vector<std::string>(sortedFontSet.begin(), sortedFontSet.end());
sortedFontListLowercase = sortedFontList;
for(std::string& s : sortedFontListLowercase)
std::transform(s.begin(), s.end(), s.begin(), ::tolower);
}
if(!fontName)