ImFont: Added AddRemapChar() helper (#609)

This commit is contained in:
ocornut
2016-04-26 10:08:06 +02:00
parent 247da0e01b
commit 4b6e9ac396
3 changed files with 39 additions and 11 deletions

10
imgui.h
View File

@ -1316,10 +1316,10 @@ struct ImFont
IMGUI_API ~ImFont();
IMGUI_API void Clear();
IMGUI_API void BuildLookupTable();
IMGUI_API const Glyph* FindGlyph(unsigned short c) const;
IMGUI_API const Glyph* FindGlyph(ImWchar c) const;
IMGUI_API void SetFallbackChar(ImWchar c);
float GetCharAdvance(unsigned short c) const { return ((int)c < IndexXAdvance.Size) ? IndexXAdvance[(int)c] : FallbackXAdvance; }
bool IsLoaded() const { return ContainerAtlas != NULL; }
float GetCharAdvance(ImWchar c) const { return ((int)c < IndexXAdvance.Size) ? IndexXAdvance[(int)c] : FallbackXAdvance; }
bool IsLoaded() const { return ContainerAtlas != NULL; }
// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
@ -1327,6 +1327,10 @@ struct ImFont
IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const;
IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;
// Private
IMGUI_API void GrowIndex(int new_size);
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.
};
//---- Include imgui_user.h at the end of imgui.h