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

This commit is contained in:
ocornut
2025-01-16 14:57:33 +01:00
parent 2bf6552f2f
commit bd19bc5085
2 changed files with 2 additions and 19 deletions

View File

@@ -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)