0
0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-18 17:11:23 +01:00

Fonts: fixed a crash when trying to use AddFont() with MergeMode=true on a font that has already been rendered. (#9162)

This commit is contained in:
ocornut
2026-01-12 18:17:38 +01:00
parent d1c5a66557
commit f64c7c37ef
2 changed files with 3 additions and 0 deletions

View File

@@ -3049,6 +3049,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg_in)
{
IM_ASSERT(Fonts.Size > 0 && "Cannot use MergeMode for the first font"); // When using MergeMode make sure that a font has already been added before.
font = font_cfg_in->DstFont ? font_cfg_in->DstFont : Fonts.back();
ImFontAtlasFontDiscardBakes(this, font, 0); // Need to discard bakes if the font was already used, because baked->FontLoaderDatas[] will change size. (#9162)
}
// Add to list