From e74a50f525e880f3a121ecd5b9ff0b33025d5778 Mon Sep 17 00:00:00 2001 From: "Andrew D. Zonenberg" Date: Wed, 28 Sep 2022 08:19:34 -0700 Subject: [PATCH] Added GetGlyphRangesGreek() helper for Greek & Coptic glyph range. (#5676, #5727) --- docs/CHANGELOG.txt | 3 ++- imgui.h | 1 + imgui_draw.cpp | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e47523f1ec1e..9bb793476b55 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -138,9 +138,10 @@ Other Changes: - Nav: Fixed moving/resizing window with gamepad or keyboard when running at very high framerate. - Nav: Pressing Space/GamepadFaceDown on a repeating button uses the same repeating rate as a mouse hold. - Nav: Fixed an issue opening a menu with Right key from a non-menu window. -- Fonts, Text: Fixed wrapped-text not doing a fast-forward on lines above the clipping region, +- Text: Fixed wrapped-text not doing a fast-forward on lines above the clipping region, which would result in an abnormal number of vertices created (was slower and more likely to asserts with 16-bits ImDrawVtx). (#5720) +- Fonts: Added GetGlyphRangesGreek() helper for Greek & Coptic glyph range. (#5676, #5727) [@azonenberg] - Platform IME: [Windows] Removed call to ImmAssociateContextEx() leading to freeze on some setups. (#2589, #5535, #5264, #4972) - Misc: ImGuiKey is now a typed enum, allowing ImGuiKey_XXX symbols to be named in debuggers. (#4921) diff --git a/imgui.h b/imgui.h index de1340f9aa6b..7a3fab7ef0de 100644 --- a/imgui.h +++ b/imgui.h @@ -2781,6 +2781,7 @@ struct ImFontAtlas // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. // NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data. IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin + IMGUI_API const ImWchar* GetGlyphRangesGreek(); // Default + Greek and Coptic IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs IMGUI_API const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 27fcd6dbc5ed..00dbe06c7614 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2821,6 +2821,17 @@ const ImWchar* ImFontAtlas::GetGlyphRangesDefault() return &ranges[0]; } +const ImWchar* ImFontAtlas::GetGlyphRangesGreek() +{ + static const ImWchar ranges[] = + { + 0x0020, 0x00FF, // Basic Latin + Latin Supplement + 0x0370, 0x03FF, // Greek and Coptic + 0, + }; + return &ranges[0]; +} + const ImWchar* ImFontAtlas::GetGlyphRangesKorean() { static const ImWchar ranges[] =