refactoring

This commit is contained in:
ohyzha
2025-01-20 13:06:11 +02:00
parent ee71d265d0
commit af86e63b32
5 changed files with 23 additions and 20 deletions

View File

@@ -5,6 +5,7 @@
*/
#include "Host/SystemFontResolver.hpp"
#include "Base/Utils.hpp"
#include <Windows.h>
#include <filesystem>
@@ -12,12 +13,11 @@
namespace OpenVulkano
{
std::string SystemFontResolver::GetSystemFontPath(const std::string& fontName)
const std::string& SystemFontResolver::GetSystemFontPath(const std::string& fontName)
{
// font name -> filename
static std::map<std::string, std::string> fontFileMapping = ReadSystemFonts();
// maybe check everything in lower case ? so that we can use Arial/arial as input parameter
auto it = fontFileMapping.find(fontName);
auto it = fontFileMapping.find(Utils::ToLower(fontName));
return it == fontFileMapping.end() ? "" : it->second;
}
@@ -57,6 +57,7 @@ namespace OpenVulkano
}
}
fontNameCropped.resize(realSize);
Utils::ToLower(fontNameCropped);
fontFileMapping[std::move(fontNameCropped)] = fontFilename.path().string();
}
}