1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-09 23:54:20 +00:00

Fonts: amend/comment on FontDataOwnedByAtlas=false fix being a breaking change. (#9086, #8465)

This commit is contained in:
ocornut 2025-12-10 21:42:07 +01:00
parent a07b2828ce
commit 9971251574
4 changed files with 20 additions and 6 deletions

View file

@ -41,14 +41,21 @@ HOW TO UPDATE?
Breaking Changes:
- Fonts: Fixed handling of `ImFontConfig::FontDataOwnedByAtlas = false` which
did erroneously make a copy of the font data, essentially defeating the purpose
of this flag and wasting memory (undetected since July 2015 and now spotted
by @TellowKrinkle, this is perhaps the oldest bug in Dear ImGui history,
albeit for a rarely used feature!) (#9086, #8465)
HOWEVER, fixing this bug is likely to surface bugs in user/app code:
- Prior to 1.92, font data only needs to be available during the atlas->AddFontXXX() call.
- Since 1.92, font data needs to available until atlas->RemoveFont(), or more typically
until a shutdown of the owning context or font atlas.
- The fact that handling of `FontDataOwnedByAtlas = false` was broken
bypassed the issue altogether.
Other Changes:
- Fonts:
- Fixed handling of `ImFontConfig::FontDataOwnedByAtlas = false` which
did erroneously make a copy of the font data, essentially defeating the purpose
of this flag and wasting memory.
Undetected since July 2015 and now spotted by @TellowKrinkle, this is perhaps
the oldest bug in Dear ImGui history (albeit for a rarely used feature)! (#9086)
- Fixed an issue related to EllipsisChar handling, while changing
font loader or font loader flags dynamically in Style->Fonts menus.
- Textures:

View file

@ -228,6 +228,7 @@ ImFontConfig font_cfg;
font_cfg.FontDataOwnedByAtlas = false;
ImFont* font = io.Fonts->AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg);
```
IMPORTANT: Since 1.92, when using `FontDataOwnedByAtlas = false`, font data needs to available until `atlas->RemoveFont()`, or more typically until a shutdown of the owning context or font atlas. It was not immediately noticeable in 1.92.0 due to a bug in handling `FontDataOwnedByAtlas = false`, which was fixed in 1.92.6.
##### [Return to Index](#index)