mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-28 07:47:02 -05:00
Fonts: added ImFontAtlas::SetFontLoader() to dynamically change font loader at runtime without using internal API. (#8752, #8465)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user