Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only.
| 7101 | |
| 7102 | // Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only. |
| 7103 | void ImGui::SetCurrentFont(ImFont* font) |
| 7104 | { |
| 7105 | ImGuiContext& g = *GImGui; |
| 7106 | IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? |
| 7107 | IM_ASSERT(font->Scale > 0.0f); |
| 7108 | g.Font = font; |
| 7109 | g.FontBaseSize = ImMax(1.0f, g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale); |
| 7110 | g.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f; |
| 7111 | |
| 7112 | ImFontAtlas* atlas = g.Font->ContainerAtlas; |
| 7113 | g.DrawListSharedData.TexUvWhitePixel = atlas->TexUvWhitePixel; |
| 7114 | g.DrawListSharedData.TexUvLines = atlas->TexUvLines; |
| 7115 | g.DrawListSharedData.Font = g.Font; |
| 7116 | g.DrawListSharedData.FontSize = g.FontSize; |
| 7117 | } |
| 7118 | |
| 7119 | void ImGui::PushFont(ImFont* font) |
| 7120 | { |