set the max font tex height to 16384

fixes a crash on macOS
This commit is contained in:
tildearrow 2025-03-22 12:38:18 -05:00
parent 9297ff7c8b
commit faa84fd464
2 changed files with 2 additions and 2 deletions

View file

@ -2654,7 +2654,7 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
// 5. Start packing // 5. Start packing
// Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values). // Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values).
const int TEX_HEIGHT_MAX = 1024 * 32; const int TEX_HEIGHT_MAX = 1024 * 16;
stbtt_pack_context spc = {}; stbtt_pack_context spc = {};
stbtt_PackBegin(&spc, NULL, atlas->TexWidth, TEX_HEIGHT_MAX, 0, atlas->TexGlyphPadding, NULL); stbtt_PackBegin(&spc, NULL, atlas->TexWidth, TEX_HEIGHT_MAX, 0, atlas->TexGlyphPadding, NULL);
ImFontAtlasBuildPackCustomRects(atlas, spc.pack_info); ImFontAtlasBuildPackCustomRects(atlas, spc.pack_info);

View file

@ -617,7 +617,7 @@ bool ImFontAtlasBuildWithFreeTypeEx(FT_Library ft_library, ImFontAtlas* atlas, u
// 5. Start packing // 5. Start packing
// Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values). // Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values).
const int TEX_HEIGHT_MAX = 1024 * 32; const int TEX_HEIGHT_MAX = 1024 * 16;
const int num_nodes_for_packing_algorithm = atlas->TexWidth - atlas->TexGlyphPadding; const int num_nodes_for_packing_algorithm = atlas->TexWidth - atlas->TexGlyphPadding;
ImVector<stbrp_node> pack_nodes; ImVector<stbrp_node> pack_nodes;
pack_nodes.resize(num_nodes_for_packing_algorithm); pack_nodes.resize(num_nodes_for_packing_algorithm);