Browse Source

Font: Renamed ImFont::Clear() to ImFont::ClearOutputData() for consistency with what ImFontAtlas does. DisplayOffset is set by constructor but not reset by ClearOutputData. (#1349)

pull/1692/head
omar 7 years ago
parent
commit
7f880674e5
  1. 2
      imgui.h
  2. 14
      imgui_draw.cpp

2
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);

14
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();

Loading…
Cancel
Save