From 65ebca81576da6fbacb0163a6a479973344ed02c Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 2 Apr 2026 18:34:05 +0200 Subject: [PATCH] Fonts: fixed an issue introduced in 1.92.6 where style.FontBaseSize would be cleared during the first frame if no fonts was explicitely added before. Amend 3aba95060e --- docs/CHANGELOG.txt | 2 ++ imgui_draw.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index fd48e5e1c..03eb9ed1c 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -109,6 +109,8 @@ Other Changes: - Angled Headers: angled section for column being reordered via the regular headers stays highlighted during reordering. - Style: + - Fonts: fixed an issue introduced in 1.92.6 where style.FontBaseSize would be + cleared during the first frame if no fonts was explicitely added before. - Border sizes are now scaled (and rounded) by ScaleAllSizes(). - When using large values with ScallAllSizes(), the following items thickness are scaled to integer amounts: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 680d6af02..085f9f11c 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -3258,7 +3258,9 @@ void ImFontAtlasBuildNotifySetFont(ImFontAtlas* atlas, ImFont* old_font, ImFont* shared_data->Font = new_font; if (ImGuiContext* ctx = shared_data->Context) { - if (ctx->FrameCount == 0 && old_font == NULL) // While this should work either way, we save ourselves the bother / debugging confusion of running ImGui code so early when it is not needed. + // While this should work either way, we save ourselves the bother / debugging confusion of running ImGui code so early when it is not needed. + // Also fixes erroneously rewriting style.FontSizeBase during init if adding default fonts. + if (old_font == NULL && ctx->Font == NULL && ctx->FontSizeBase == 0.0f) continue; if (ctx->IO.FontDefault == old_font)