Browse Source

Fonts: Removed BuildClearGlyphs(), conflated with ClearOutputData()

ocornut 7 months ago
parent
commit
bd19bc5085
2 changed files with 2 additions and 19 deletions
  1. 0 1
      imgui.h
  2. 2 18
      imgui_draw.cpp

+ 0 - 1
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.

+ 2 - 18
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)