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

@@ -74,6 +74,8 @@ Breaking Changes:
until a shutdown of the owning context or font atlas. until a shutdown of the owning context or font atlas.
- The fact that handling of `FontDataOwnedByAtlas = false` was broken bypassed - The fact that handling of `FontDataOwnedByAtlas = false` was broken bypassed
the issue altogether. the issue altogether.
- Fixed a crash when trying to use AddFont() with MergeMode=true on a font that
has already been rendered. (#9162) [@ocornut, @cyfewlp]
- Removed ImFontConfig::PixelSnapV added in 1.92 which turns out is unnecessary - Removed ImFontConfig::PixelSnapV added in 1.92 which turns out is unnecessary
(and misdocumented). Post-rescale GlyphOffset is always rounded. (and misdocumented). Post-rescale GlyphOffset is always rounded.
- Popups: changed compile-time 'ImGuiPopupFlags popup_flags = 1' default value to be '= 0' for - Popups: changed compile-time 'ImGuiPopupFlags popup_flags = 1' default value to be '= 0' for

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. 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(); 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 // Add to list