MCPcopy Create free account
hub / github.com/Wemino/EchoPatch / SetCurrentFont

Method SetCurrentFont

include/imgui/imgui.cpp:9022–9042  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

9020// because we have a concrete need and a test bed for multiple atlas textures.
9021// FIXME-NEWATLAS-V2: perhaps we can now leverage ImFontAtlasUpdateDrawListsTextures() ?
9022void ImGui::SetCurrentFont(ImFont* font, float font_size_before_scaling, float font_size_after_scaling)
9023{
9024 ImGuiContext& g = *GImGui;
9025 g.Font = font;
9026 g.FontSizeBase = font_size_before_scaling;
9027 UpdateCurrentFontSize(font_size_after_scaling);
9028
9029 if (font != NULL)
9030 {
9031 IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?
9032#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
9033 IM_ASSERT(font->Scale > 0.0f);
9034#endif
9035 ImFontAtlas* atlas = font->OwnerAtlas;
9036 g.DrawListSharedData.FontAtlas = atlas;
9037 g.DrawListSharedData.Font = font;
9038 ImFontAtlasUpdateDrawListsSharedData(atlas);
9039 if (g.CurrentWindow != NULL)
9040 g.CurrentWindow->DrawList->_SetTexture(atlas->TexRef);
9041 }
9042}
9043
9044void ImGui::UpdateCurrentFontSize(float restore_font_size_after_scaling)
9045{

Callers

nothing calls this directly

Calls 3

IsLoadedMethod · 0.80
_SetTextureMethod · 0.80

Tested by

no test coverage detected