Fonts: Allowing PushFont()/PopFont() to be called outside the imgui frame scope. (#3621)

This commit is contained in:
ocornut
2024-12-20 17:17:40 +01:00
parent d30e102f3a
commit 61d4bf95dc
2 changed files with 5 additions and 2 deletions

View File

@@ -8018,7 +8018,8 @@ void ImGui::PushFont(ImFont* font)
font = GetDefaultFont();
g.FontStack.push_back(font);
SetCurrentFont(font);
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
if (ImGuiWindow* window = g.CurrentWindow)
window->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
}
void ImGui::PopFont()
@@ -8032,7 +8033,8 @@ void ImGui::PopFont()
g.FontStack.pop_back();
ImFont* font = g.FontStack.Size == 0 ? GetDefaultFont() : g.FontStack.back();
SetCurrentFont(font);
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
if (ImGuiWindow* window = g.CurrentWindow)
window->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
}
void ImGui::PushItemFlag(ImGuiItemFlags option, bool enabled)