From bd19bc50858d80113080fd22f7a8538d953e3c7c Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 16 Jan 2025 14:57:33 +0100 Subject: [PATCH] Fonts: Removed BuildClearGlyphs(), conflated with ClearOutputData() --- imgui.h | 1 - imgui_draw.cpp | 20 ++------------------ 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/imgui.h b/imgui.h index 73e3f7edd..1baa4067a 100644 --- a/imgui.h +++ b/imgui.h @@ -3673,7 +3673,6 @@ struct ImFont IMGUI_API bool IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last); IMGUI_API ImFontGlyph* BuildLoadGlyph(ImWchar c); IMGUI_API void BuildGrowIndex(int new_size); - IMGUI_API void BuildClearGlyphs(); }; // Added indirection to avoid patching ImDrawCmd after texture updates. diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 5e9d1de91..2351b2f51 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2522,8 +2522,6 @@ void ImTextureData::DestroyPixels() // - ImFontAtlasPackGetRect() //----------------------------------------------------------------------------- // - ImFont::BuildLoadGlyph() -// - ImFont::BuildClearGlyphs() -//----------------------------------------------------------------------------- // - ImFontAtlasDebugLogTextureRequests() //----------------------------------------------------------------------------- // - ImFontAtlasGetFontLoaderForStbTruetype() @@ -3581,7 +3579,7 @@ void ImFontAtlasBuildDiscardFontGlyphs(ImFontAtlas* atlas, ImFont* font) for (ImFontGlyph& glyph : font->Glyphs) if (glyph.PackId >= 0) ImFontAtlasPackDiscardRect(atlas, glyph.PackId); - font->BuildClearGlyphs(); + font->ClearOutputData(); font->FallbackChar = font->EllipsisChar = 0; } @@ -3915,7 +3913,7 @@ void ImFontAtlasBuildInit(ImFontAtlas* atlas) void ImFontAtlasBuildDestroy(ImFontAtlas* atlas) { for (ImFont* font : atlas->Fonts) - font->BuildClearGlyphs(); + font->ClearOutputData(); if (atlas->FontLoader && atlas->FontLoader->FontSrcDestroy != NULL) for (ImFontConfig& font_cfg : atlas->Sources) atlas->FontLoader->FontSrcDestroy(atlas, &font_cfg); @@ -4650,30 +4648,16 @@ ImFont::~ImFont() void ImFont::ClearOutputData() { - FontSize = 0.0f; FallbackAdvanceX = 0.0f; Glyphs.clear(); IndexAdvanceX.clear(); IndexLookup.clear(); FallbackGlyphIndex = -1; - ContainerAtlas = NULL; Ascent = Descent = 0.0f; MetricsTotalSurface = 0; memset(Used8kPagesMap, 0, sizeof(Used8kPagesMap)); } -void ImFont::BuildClearGlyphs() -{ - FallbackAdvanceX = 0.0f; - Glyphs.clear(); - IndexAdvanceX.clear(); - IndexLookup.clear(); - FallbackGlyphIndex = 0; - MetricsTotalSurface = 0; - memset(Used8kPagesMap, 0, sizeof(Used8kPagesMap)); - // Don't clear BuilderData -} - // API is designed this way to avoid exposing the 8K page size // e.g. use with IsGlyphRangeUnused(0, 255) bool ImFont::IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last)