Fonts: fixed legacy backend path preloading all sources sizes erroneously + failing to use ellipsis.

This commit is contained in:
ocornut
2025-03-20 15:44:35 +01:00
parent 5460903f96
commit 2de15dc64b
+9 -3
View File
@@ -3383,16 +3383,22 @@ void ImFontAtlasBuildPreloadAllGlyphRanges(ImFontAtlas* atlas)
{ {
atlas->Builder->PreloadedAllGlyphsRanges = true; atlas->Builder->PreloadedAllGlyphsRanges = true;
for (ImFont* font : atlas->Fonts) for (ImFont* font : atlas->Fonts)
{
ImFontConfig* src = &font->Sources[0];
ImFontBaked* baked = font->GetFontBaked(src->SizePixels);
if (font->FallbackChar != 0)
baked->FindGlyph(font->FallbackChar);
if (font->EllipsisChar != 0)
baked->FindGlyph(font->EllipsisChar);
for (int src_n = 0; src_n < font->SourcesCount; src_n++) for (int src_n = 0; src_n < font->SourcesCount; src_n++)
{ {
ImFontConfig* src = &font->Sources[src_n]; src = &font->Sources[src_n];
ImFontBaked* baked = font->GetFontBaked(src->SizePixels);
const ImWchar* ranges = src->GlyphRanges ? src->GlyphRanges : atlas->GetGlyphRangesDefault(); const ImWchar* ranges = src->GlyphRanges ? src->GlyphRanges : atlas->GetGlyphRangesDefault();
IM_ASSERT(ranges != NULL);
for (; ranges[0]; ranges += 2) for (; ranges[0]; ranges += 2)
for (unsigned int c = ranges[0]; c <= ranges[1] && c <= IM_UNICODE_CODEPOINT_MAX; c++) //-V560 for (unsigned int c = ranges[0]; c <= ranges[1] && c <= IM_UNICODE_CODEPOINT_MAX; c++) //-V560
baked->FindGlyph((ImWchar)c); baked->FindGlyph((ImWchar)c);
} }
}
} }
void ImFontAtlasBuildUpdatePointers(ImFontAtlas* atlas) void ImFontAtlasBuildUpdatePointers(ImFontAtlas* atlas)