Skip to content

Commit 61d4bf9

Browse files
committed
Fonts: Allowing PushFont()/PopFont() to be called outside the imgui frame scope. (#3621)
1 parent d30e102 commit 61d4bf9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Other changes:
5858
yourself based on your own logic. (#8223)
5959
- Nav: Fixed an issue where Alt key would clear current active item on
6060
windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
61+
- Fonts: Allowing PushFont()/PopFont() to be called outside the imgui frame scope. (#3621)
6162
- Debug Tools: Debug Log: hovering 0xXXXXXXXX values in log is allowed even
6263
if a popup is blocking mouse access to the debug log window. (#5855)
6364
- Backends: Vulkan: Fixed setting VkSwapchainCreateInfoKHR::preTransform for

imgui.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8018,7 +8018,8 @@ void ImGui::PushFont(ImFont* font)
80188018
font = GetDefaultFont();
80198019
g.FontStack.push_back(font);
80208020
SetCurrentFont(font);
8021-
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
8021+
if (ImGuiWindow* window = g.CurrentWindow)
8022+
window->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
80228023
}
80238024

80248025
void ImGui::PopFont()
@@ -8032,7 +8033,8 @@ void ImGui::PopFont()
80328033
g.FontStack.pop_back();
80338034
ImFont* font = g.FontStack.Size == 0 ? GetDefaultFont() : g.FontStack.back();
80348035
SetCurrentFont(font);
8035-
g.CurrentWindow->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
8036+
if (ImGuiWindow* window = g.CurrentWindow)
8037+
window->DrawList->_SetTextureID(font->ContainerAtlas->TexID);
80368038
}
80378039

80388040
void ImGui::PushItemFlag(ImGuiItemFlags option, bool enabled)

0 commit comments

Comments
 (0)