Use ImDrawList::_SetTexture(), making our shared g.FontStack[] authoritative against window-local ImDrawList. - Whereas ImDrawList::PushTexture()/PopTexture() is not to be used across Begin() calls. - Note that we don't propagate current texture id when e.g. Begin()-ing into a new window, we never really did... - Some code paths never really fully worked with multiple atlas textures. - The right-i
| 9084 | // because we have a concrete need and a test bed for multiple atlas textures. |
| 9085 | // FIXME-NEWATLAS-V2: perhaps we can now leverage ImFontAtlasUpdateDrawListsTextures() ? |
| 9086 | void ImGui::SetCurrentFont(ImFont* font, float font_size_before_scaling, float font_size_after_scaling) |
| 9087 | { |
| 9088 | ImGuiContext& g = *GImGui; |
| 9089 | g.Font = font; |
| 9090 | g.FontSizeBase = font_size_before_scaling; |
| 9091 | UpdateCurrentFontSize(font_size_after_scaling); |
| 9092 | |
| 9093 | if (font != NULL) |
| 9094 | { |
| 9095 | IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? |
| 9096 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 9097 | IM_ASSERT(font->Scale > 0.0f); |
| 9098 | #endif |
| 9099 | ImFontAtlas* atlas = font->OwnerAtlas; |
| 9100 | g.DrawListSharedData.FontAtlas = atlas; |
| 9101 | g.DrawListSharedData.Font = font; |
| 9102 | ImFontAtlasUpdateDrawListsSharedData(atlas); |
| 9103 | if (g.CurrentWindow != NULL) |
| 9104 | g.CurrentWindow->DrawList->_SetTexture(atlas->TexRef); |
| 9105 | } |
| 9106 | } |
| 9107 | |
| 9108 | void ImGui::UpdateCurrentFontSize(float restore_font_size_after_scaling) |
| 9109 | { |
nothing calls this directly
no test coverage detected