refactoring
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user