mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 00:10:04 +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;
|
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
|
// Create an ImGui font
|
||||||
std::shared_ptr<types::ImGuiFont> imguiFont =
|
std::shared_ptr<types::ImGuiFont> imguiFont =
|
||||||
std::make_shared<types::ImGuiFont>(
|
std::make_shared<types::ImGuiFont>(fontName, rawFontData, imFontSize);
|
||||||
fontRecord.filename_, rawFontData, imFontSize);
|
|
||||||
|
|
||||||
// Store the ImGui font
|
// Store the ImGui font
|
||||||
p->imguiFonts_.insert_or_assign(imguiFontKey, imguiFont);
|
p->imguiFonts_.insert_or_assign(imguiFontKey, imguiFont);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue