fix font resolution when not explicitly adding regular

This commit is contained in:
Georg Hagen
2025-02-04 22:59:31 +01:00
parent 8926f5dd51
commit c8d81e3187

View File

@@ -17,8 +17,12 @@ namespace OpenVulkano
// fontName -> fontPath // fontName -> fontPath
static std::map<std::string, std::string> fontFilesMapping = ReadSystemFonts(); static std::map<std::string, std::string> fontFilesMapping = ReadSystemFonts();
static std::string fallbackString; static std::string fallbackString;
auto it = fontFilesMapping.find(Utils::ToLower(fontName)); std::string fontNameLower = Utils::ToLower(fontName);
return it == fontFilesMapping.end() ? fallbackString : it->second; auto it = fontFilesMapping.find(fontNameLower);
if (it != fontFilesMapping.end()) return it->second;
it = fontFilesMapping.find(fontNameLower + " regular");
if (it != fontFilesMapping.end()) return it->second;
return fallbackString;
} }
std::map<std::string, std::string> SystemFontResolver::ReadSystemFonts() std::map<std::string, std::string> SystemFontResolver::ReadSystemFonts()