1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-09 23:54:20 +00:00

Fonts: added ImFontAtlas::SetFontLoader() to dynamically change font loader at runtime without using internal API. (#8752, #8465)

This commit is contained in:
ocornut 2025-06-30 20:01:02 +02:00
parent 8ccfdf7ba0
commit b7e5d76c79
5 changed files with 20 additions and 11 deletions

View file

@ -2659,6 +2659,11 @@ void ImFontAtlas::CompactCache()
ImFontAtlasTextureCompact(this);
}
void ImFontAtlas::SetFontLoader(const ImFontLoader* font_loader)
{
ImFontAtlasBuildSetupFontLoader(this, font_loader);
}
void ImFontAtlas::ClearInputData()
{
IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!");
@ -4178,9 +4183,9 @@ void ImFontAtlasBuildInit(ImFontAtlas* atlas)
if (atlas->FontLoader == NULL)
{
#ifdef IMGUI_ENABLE_FREETYPE
ImFontAtlasBuildSetupFontLoader(atlas, ImGuiFreeType::GetFontLoader());
atlas->SetFontLoader(ImGuiFreeType::GetFontLoader());
#elif defined(IMGUI_ENABLE_STB_TRUETYPE)
ImFontAtlasBuildSetupFontLoader(atlas, ImFontAtlasGetFontLoaderForStbTruetype());
atlas->SetFontLoader(ImFontAtlasGetFontLoaderForStbTruetype());
#else
IM_ASSERT(0); // Invalid Build function
#endif