Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only.
| 7790 | |
| 7791 | // Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only. |
| 7792 | void ImGui::SetCurrentFont(ImFont* font) |
| 7793 | { |
| 7794 | ImGuiContext& g = *GImGui; |
| 7795 | IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? |
| 7796 | IM_ASSERT(font->Scale > 0.0f); |
| 7797 | g.Font = font; |
| 7798 | g.FontBaseSize = ImMax(1.0f, g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale); |
| 7799 | g.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f; |
| 7800 | |
| 7801 | ImFontAtlas* atlas = g.Font->ContainerAtlas; |
| 7802 | g.DrawListSharedData.TexUvWhitePixel = atlas->TexUvWhitePixel; |
| 7803 | g.DrawListSharedData.TexUvLines = atlas->TexUvLines; |
| 7804 | g.DrawListSharedData.Font = g.Font; |
| 7805 | g.DrawListSharedData.FontSize = g.FontSize; |
| 7806 | } |
| 7807 | |
| 7808 | void ImGui::PushFont(ImFont* font) |
| 7809 | { |