From e9aead09cb09db09864b24f40172f312f262caaf Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 29 Nov 2014 00:04:05 +0000 Subject: [PATCH] Remove unneeded extra parameter from ImFont::FindGlyph() --- imgui.cpp | 12 ++++++------ imgui.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 0d92e5bd..b6871778 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5821,7 +5821,7 @@ void ImFont::BuildLookupTable() IndexLookup[Glyphs[i].Id] = (int)i; } -const ImFont::FntGlyph* ImFont::FindGlyph(unsigned short c, const ImFont::FntGlyph* fallback) const +const ImFont::FntGlyph* ImFont::FindGlyph(unsigned short c) const { if (c < (int)IndexLookup.size()) { @@ -5829,7 +5829,7 @@ const ImFont::FntGlyph* ImFont::FindGlyph(unsigned short c, const ImFont::FntGly if (i >= 0 && i < (int)GlyphsCount) return &Glyphs[i]; } - return fallback; + return FallbackGlyph; } // Convert UTF-8 to 32-bits character, process single character input. @@ -6045,7 +6045,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c } else { - if (const FntGlyph* glyph = FindGlyph((unsigned short)c, FallbackGlyph)) + if (const FntGlyph* glyph = FindGlyph((unsigned short)c)) char_width = (glyph->XAdvance + Info->SpacingHoriz) * scale; } @@ -6158,7 +6158,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons if (const FntGlyph* glyph = FindGlyph((unsigned short)' ')) char_width = (glyph->XAdvance + Info->SpacingHoriz) * 4 * scale; } - else if (const FntGlyph* glyph = FindGlyph((unsigned short)c, FallbackGlyph)) + else if (const FntGlyph* glyph = FindGlyph((unsigned short)c)) { char_width = (glyph->XAdvance + Info->SpacingHoriz) * scale; } @@ -6216,7 +6216,7 @@ ImVec2 ImFont::CalcTextSizeW(float size, float max_width, const ImWchar* text_be } else { - if (const FntGlyph* glyph = FindGlyph((unsigned short)c, FallbackGlyph)) + if (const FntGlyph* glyph = FindGlyph((unsigned short)c)) char_width = (glyph->XAdvance + Info->SpacingHoriz) * scale; } @@ -6309,7 +6309,7 @@ void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_re if (const FntGlyph* glyph = FindGlyph((unsigned short)' ')) char_width += (glyph->XAdvance + Info->SpacingHoriz) * 4 * scale; } - else if (const FntGlyph* glyph = FindGlyph((unsigned short)c, FallbackGlyph)) + else if (const FntGlyph* glyph = FindGlyph((unsigned short)c)) { char_width = (glyph->XAdvance + Info->SpacingHoriz) * scale; if (c != ' ') diff --git a/imgui.h b/imgui.h index cf11b603..419631d8 100644 --- a/imgui.h +++ b/imgui.h @@ -726,7 +726,7 @@ struct ImFont IMGUI_API bool LoadFromFile(const char* filename); IMGUI_API void Clear(); IMGUI_API void BuildLookupTable(); - IMGUI_API const FntGlyph* FindGlyph(unsigned short c, const FntGlyph* fallback = NULL) const; + IMGUI_API const FntGlyph* FindGlyph(unsigned short c) const; IMGUI_API float GetFontSize() const { return (float)Info->FontSize; } // before scale! IMGUI_API bool IsLoaded() const { return Info != NULL && Common != NULL && Glyphs != NULL; }