diff --git a/imgui.h b/imgui.h index c8c193244..7b3601a02 100644 --- a/imgui.h +++ b/imgui.h @@ -3766,7 +3766,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 34100d85b..388138311 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2524,8 +2524,6 @@ void ImTextureData::DestroyPixels() // - ImFontAtlasPackGetRect() //----------------------------------------------------------------------------- // - ImFont::BuildLoadGlyph() -// - ImFont::BuildClearGlyphs() -//----------------------------------------------------------------------------- // - ImFontAtlasDebugLogTextureRequests() //----------------------------------------------------------------------------- // - ImFontAtlasGetFontLoaderForStbTruetype() @@ -3584,7 +3582,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; } @@ -3918,7 +3916,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); @@ -4653,30 +4651,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)