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
This commit is contained in:
ocornut
2026-04-02 18:34:05 +02:00
parent 9e9fdc97bb
commit 65ebca8157
2 changed files with 5 additions and 1 deletions

View File

@@ -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)