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

Method SetCurrentFont

include/imgui/imgui.cpp:9086–9106  ·  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

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() ?
9086void 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
9108void ImGui::UpdateCurrentFontSize(float restore_font_size_after_scaling)
9109{

Callers

nothing calls this directly

Calls 3

IsLoadedMethod · 0.80
_SetTextureMethod · 0.80

Tested by

no test coverage detected