mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Fonts: Allow PushFont/NewFrame/PopFont idioms to function.
This commit is contained in:
parent
842c313db2
commit
6580590226
1 changed files with 7 additions and 1 deletions
|
|
@ -8581,7 +8581,13 @@ void ImGui::UpdateFontsNewFrame()
|
|||
ImFontAtlas* atlas = g.IO.Fonts;
|
||||
if ((g.IO.BackendFlags & ImGuiBackendFlags_RendererHasTextures) == 0)
|
||||
atlas->Locked = true;
|
||||
PushFont(GetDefaultFont(), GetDefaultFont()->Sources[0].SizePixels);
|
||||
|
||||
// We do this really unusual thing of calling *push_front()*, the reason behind that we want to support the PushFont()/NewFrame()/PopFont() idiom.
|
||||
ImFontStackData font_stack_data = { ImGui::GetDefaultFont(), ImGui::GetDefaultFont()->Sources[0].SizePixels };
|
||||
g.FontStack.push_front(font_stack_data);
|
||||
if (g.FontStack.Size == 1)
|
||||
ImGui::SetCurrentFont(font_stack_data.Font, font_stack_data.FontSize);
|
||||
|
||||
IM_ASSERT(g.Font->IsLoaded());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue