diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 6f94e5981..03a5248bc 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -67,6 +67,8 @@ Other changes: - Misc: added GetItemID() in public API. It is not often expected that you would use this, but it is useful for Shortcut() and upcoming owner-aware input functions which wants to be implemented with public API. +- Fonts: imgui_freetype: fixed a packing issue which in some occurrences would prevent large + amount of glyphs from being packed correctly. (#5788, #5829) - Fonts: added a 'void* UserData' field in ImFontAtlas, as a convenience for use by applications using multiple font atlases. - Demo: added "Inputs->Shortcut Routing" section. diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index 03255326b..78ef29397 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -6,6 +6,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2023/01/04: fixed a packing issue which in some occurrences would prevent large amount of glyphs from being packed correctly. // 2021/08/23: fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL. // 2021/03/05: added ImGuiFreeTypeBuilderFlags_Bitmap to load bitmap glyphs. // 2021/03/02: set 'atlas->TexPixelsUseColors = true' to help some backends with deciding of a prefered texture format. @@ -586,7 +587,7 @@ bool ImFontAtlasBuildWithFreeTypeEx(FT_Library ft_library, ImFontAtlas* atlas, u ImVector pack_nodes; pack_nodes.resize(num_nodes_for_packing_algorithm); stbrp_context pack_context; - stbrp_init_target(&pack_context, atlas->TexWidth, TEX_HEIGHT_MAX, pack_nodes.Data, pack_nodes.Size); + stbrp_init_target(&pack_context, atlas->TexWidth - atlas->TexGlyphPadding, TEX_HEIGHT_MAX - atlas->TexGlyphPadding, pack_nodes.Data, pack_nodes.Size); ImFontAtlasBuildPackCustomRects(atlas, &pack_context); // 6. Pack each source font. No rendering yet, we are working with rectangles in an infinitely tall texture at this point.