diff --git a/imgui.h b/imgui.h index 68558fb4d336..ad7711dc5026 100644 --- a/imgui.h +++ b/imgui.h @@ -3461,8 +3461,8 @@ struct ImFont // Methods IMGUI_API ImFont(); IMGUI_API ~ImFont(); - IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c); - IMGUI_API const ImFontGlyph*FindGlyphNoFallback(ImWchar c); + IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const; + IMGUI_API const ImFontGlyph*FindGlyphNoFallback(ImWchar c) const; float GetCharAdvance(ImWchar c) { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; } bool IsLoaded() const { return ContainerAtlas != NULL; } const char* GetDebugName() const { return ConfigData ? ConfigData->Name : ""; } @@ -3481,7 +3481,7 @@ struct ImFont IMGUI_API void AddGlyph(const ImFontConfig* src_cfg, ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x); IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built. IMGUI_API void SetGlyphVisible(ImWchar c, bool visible); - IMGUI_API bool IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last); + IMGUI_API bool IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last) const; }; //----------------------------------------------------------------------------- diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 42bfb71625cf..aa8774e326df 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -3806,7 +3806,7 @@ void ImFont::BuildLookupTable() // API is designed this way to avoid exposing the 4K page size // e.g. use with IsGlyphRangeUnused(0, 255) -bool ImFont::IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last) +bool ImFont::IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last) const { unsigned int page_begin = (c_begin / 4096); unsigned int page_last = (c_last / 4096); @@ -3896,7 +3896,7 @@ void ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst) } // Find glyph, return fallback if missing -const ImFontGlyph* ImFont::FindGlyph(ImWchar c) +const ImFontGlyph* ImFont::FindGlyph(ImWchar c) const { if (c >= (size_t)IndexLookup.Size) return FallbackGlyph; @@ -3906,7 +3906,7 @@ const ImFontGlyph* ImFont::FindGlyph(ImWchar c) return &Glyphs.Data[i]; } -const ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) +const ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) const { if (c >= (size_t)IndexLookup.Size) return NULL;