-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font stack cannot be manipulated within different windows #3224
Comments
I confirmed this is an issue, we haven't looked at how the font stack was handled in a long while (it's not even exposing the (ugly form of) scaling). Those functions PushFont/PopFont are currently mixing up context and per-window stacks:
(The irony being that all those TextureId are going to be the same since your atlas is the same) As as quick workaround this will work if you don't need a title bar, which popups don't have: ImGui::PushFont(font2);
ImGui::Begin("test");
if (ImGui::Button("click me"))
ImGui::OpenPopup("popup");
if (ImGui::BeginPopup("popup"))
{
ImGui::PushFont(font1);
ImGui::Text("popup");
ImGui::PopFont();
ImGui::EndPopup();
}
ImGui::End();
ImGui::PopFont(); Will be looking for the proper fix. |
Amend: actually this is the proper workaround which will also work with title bars: ImGui::PushFont(font2);
ImGui::Begin("test");
if (ImGui::Button("click me"))
ImGui::OpenPopup("popup");
if (ImGui::IsPopupOpen("popup"))
{
ImGui::PushFont(font1);
if (ImGui::BeginPopup("popup"))
{
ImGui::Text("popup");
ImGui::EndPopup();
}
ImGui::PopFont();
}
ImGui::End();
ImGui::PopFont(); Question: was this popup example you posted representative of your actual issue? Trying to gauge if the workaround can unblock you for a while or if there is some need to find a more generic solution soon. |
Yes -- wolfpld/tracy@e330b96. Since a workaround exists, it's not a pressing issue. (I use fixed width font to display source/asm code, but I do need to occasionally jump back to default font with icons, etc.) |
I have pushed a fix for this: eb7201b (It's not a perfect fix, in theory our code and system are still rather broken for the case of using multiple atlases textures, but I don't think that has been fully exercised ever, so we'll address that when the time comes.) |
Version:
03ea87ea28
Branch:
docking
Required setup:
Test code:
This will display a window using a custom font (
font
), with the intention to display popup contents using the default one. This doesn't happen, asAddText()
crashes in assert atimgui_draw.cpp:1228
(due to_TextureIdStack
being empty).The text was updated successfully, but these errors were encountered: