From a92c587c75c42334f064476c5ac25a450dfd6bf6 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 11 Mar 2019 22:02:59 +0100 Subject: [PATCH] Added GetGlyphRangesVietnamese() helper. (#2403) --- docs/CHANGELOG.txt | 1 + imgui.h | 1 + imgui_draw.cpp | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index ff2f387b..423844ff 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -85,6 +85,7 @@ Other Changes: - Log/Capture: Fixed LogXXX functions 'auto_open_depth' parameter being treated as an absolute tree depth instead of a relative one. - Log/Capture: Fixed CollapsingHeader trailing ascii representation being "#" instead of "##". +- ImFont: Added GetGlyphRangesVietnamese() helper. (#2403) - Misc: Asserting in NewFrame() if style.WindowMinSize is zero or smaller than (1.0f,1.0f). - Demo: Using GetBackgroundDrawList() and GetForegroundDrawList() in "Custom Rendering" demo. - Examples: OpenGL: Fix to be able to run on ES 2.0 / WebGL 1.0. [@rmitton, @gabrielcuvillier] diff --git a/imgui.h b/imgui.h index 2fbf4fc3..6616ace3 100644 --- a/imgui.h +++ b/imgui.h @@ -2047,6 +2047,7 @@ struct ImFontAtlas IMGUI_API const ImWchar* GetGlyphRangesChineseSimplifiedCommon();// Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters IMGUI_API const ImWchar* GetGlyphRangesThai(); // Default + Thai characters + IMGUI_API const ImWchar* GetGlyphRangesVietnamese(); // Default + Vietname characters //------------------------------------------- // Custom Rectangles/Glyphs API diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 52175e29..203b6f7b 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2346,6 +2346,23 @@ const ImWchar* ImFontAtlas::GetGlyphRangesThai() return &ranges[0]; } +const ImWchar* ImFontAtlas::GetGlyphRangesVietnamese() +{ + static const ImWchar ranges[] = + { + 0x0020, 0x00FF, // Basic Latin + 0x0102, 0x0103, + 0x0110, 0x0111, + 0x0128, 0x0129, + 0x0168, 0x0169, + 0x01A0, 0x01A1, + 0x01AF, 0x01B0, + 0x1EA0, 0x1EF9, + 0, + }; + return &ranges[0]; +} + //----------------------------------------------------------------------------- // [SECTION] ImFontGlyphRangesBuilder //-----------------------------------------------------------------------------