mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:40:05 +00:00
Use a more friendly name for ImGui font registration
This commit is contained in:
parent
0d7b9ae9a7
commit
7af2edd3ec
1 changed files with 16 additions and 2 deletions
|
|
@ -261,10 +261,24 @@ FontManager::LoadImGuiFont(const std::string& family,
|
|||
return it->second;
|
||||
}
|
||||
|
||||
// Define a name for the ImGui font
|
||||
std::string fontName;
|
||||
try
|
||||
{
|
||||
fontName = fmt::format(
|
||||
"{}:{}",
|
||||
std::filesystem::path(fontRecord.filename_).filename().string(),
|
||||
imFontSize.value());
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
logger_->warn(ex.what());
|
||||
fontName = fmt::format("{}:{}", fontRecord.filename_, imFontSize.value());
|
||||
}
|
||||
|
||||
// Create an ImGui font
|
||||
std::shared_ptr<types::ImGuiFont> imguiFont =
|
||||
std::make_shared<types::ImGuiFont>(
|
||||
fontRecord.filename_, rawFontData, imFontSize);
|
||||
std::make_shared<types::ImGuiFont>(fontName, rawFontData, imFontSize);
|
||||
|
||||
// Store the ImGui font
|
||||
p->imguiFonts_.insert_or_assign(imguiFontKey, imguiFont);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue