From 7f880674e5c3e594ac034215252b7d1455a1579f Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 22 Oct 2017 10:24:56 +0200 Subject: [PATCH] Font: Renamed ImFont::Clear() to ImFont::ClearOutputData() for consistency with what ImFontAtlas does. DisplayOffset is set by constructor but not reset by ClearOutputData. (#1349) --- imgui.h | 2 +- imgui_draw.cpp | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/imgui.h b/imgui.h index e281b4f1..c865d357 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 302c338b..c3a5f3d5 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();