Skip to content

Commit

Permalink
ImFontAtlas: made calling ClearFonts() call ClearInputData(). (#8174, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Jan 23, 2025
1 parent 71da34c commit 1019934
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Breaking changes:

Other changes:

- ImDrawList: texture baked storage for thick line reduced from ~64x64 to ~32x32. (#3245)
- imgui_freetype: fixed issue where glyph advances would incorrectly be
snapped to pixels. Effectively it would only be noticeable when hinting
is disabled with ImGuiFreeTypeBuilderFlags_NoHinting, as hinting itself
Expand All @@ -74,6 +73,9 @@ Other changes:
increased default rounding (style.TabRounding). (#8334) [@Kian738, @ocornut]
styles as the current look is not right (but ImGuiCol_TabSelectedOverline stays the same).
- Debug Tools: Tweaked font preview.
- ImDrawList: texture baked storage for thick line reduced from ~64x64 to ~32x32. (#3245)
- ImFontAtlas: made calling ClearFonts() call ClearInputData(), as calling
one without the other is never correct. (#8174, #6556, #6336, #4723)
- Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in
provided example, to reduce latency.
- Examples: Vulkan: better handle VK_SUBOPTIMAL_KHR being returned by
Expand Down
2 changes: 1 addition & 1 deletion imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -3355,8 +3355,8 @@ struct ImFontAtlas
IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_font_data, int compressed_font_data_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
IMGUI_API void ClearInputData(); // Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts.
IMGUI_API void ClearFonts(); // Clear input+output font data (same as ClearInputData() + glyphs storage, UV coordinates).
IMGUI_API void ClearTexData(); // Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory.
IMGUI_API void ClearFonts(); // Clear output font data (glyphs storage, UV coordinates).
IMGUI_API void Clear(); // Clear all input and output.

// Build atlas, retrieve pixel data.
Expand Down
1 change: 1 addition & 0 deletions imgui_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,7 @@ void ImFontAtlas::ClearTexData()
void ImFontAtlas::ClearFonts()
{
IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!");
ClearInputData();
Fonts.clear_delete();
TexReady = false;
}
Expand Down

0 comments on commit 1019934

Please sign in to comment.