diff --git a/imgui.h b/imgui.h index e281b4f1a..c865d3578 100644 --- a/imgui.h +++ b/imgui.h @@ -1500,7 +1500,7 @@ struct ImFont // Methods IMGUI_API ImFont(); IMGUI_API ~ImFont(); - IMGUI_API void Clear(); + IMGUI_API void ClearOutputData(); IMGUI_API void BuildLookupTable(); IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const; IMGUI_API void SetFallbackChar(ImWchar c); diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 302c338bb..c3a5f3d5c 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1618,12 +1618,8 @@ void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* f { if (!font_config->MergeMode) { - ImVec2 display_offset = font->DisplayOffset; - - font->Clear(); - + font->ClearOutputData(); font->FontSize = font_config->SizePixels; - font->DisplayOffset = display_offset; font->ConfigData = font_config; font->ContainerAtlas = atlas; font->Ascent = ascent; @@ -1904,7 +1900,8 @@ ImFont::ImFont() { Scale = 1.0f; FallbackChar = (ImWchar)'?'; - Clear(); + DisplayOffset = ImVec2(0.0f, 1.0f); + ClearOutputData(); } ImFont::~ImFont() @@ -1917,13 +1914,12 @@ ImFont::~ImFont() if (g.Font == this) g.Font = NULL; */ - Clear(); + ClearOutputData(); } -void ImFont::Clear() +void ImFont::ClearOutputData() { FontSize = 0.0f; - DisplayOffset = ImVec2(0.0f, 1.0f); Glyphs.clear(); IndexAdvanceX.clear(); IndexLookup.clear();