font fallback?

This commit is contained in:
2025-12-28 17:49:24 -05:00
parent 33c55806a4
commit 7e988dbb7f
3 changed files with 46 additions and 2 deletions
+17
View File
@@ -11,6 +11,14 @@ namespace anm2ed::resource
pointer = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(data, length, size, &config);
}
Font::Font(const char* path, int size, int number)
{
ImFontConfig config;
config.FontDataOwnedByAtlas = false;
config.FontNo = number;
pointer = ImGui::GetIO().Fonts->AddFontFromFileTTF(path, size);
}
void Font::append(void* data, size_t length, int size)
{
ImFontConfig config;
@@ -19,6 +27,15 @@ namespace anm2ed::resource
ImGui::GetIO().Fonts->AddFontFromMemoryTTF(data, length, size, &config);
}
bool Font::append(const char* path, int size, int number)
{
ImFontConfig config;
config.MergeMode = true;
config.FontDataOwnedByAtlas = false;
config.FontNo = number;
return ImGui::GetIO().Fonts->AddFontFromFileTTF(path, size, &config);
}
Font::~Font()
{
if (get()) ImGui::GetIO().Fonts->RemoveFont(pointer);