mirror of
https://github.com/ocornut/imgui.git
synced 2025-02-06 14:24:29 +01:00
Added GetGlyphRangesCyrillic() helper (#237)
This commit is contained in:
parent
0f38a53d28
commit
2a041cfbe1
18
imgui.cpp
18
imgui.cpp
@ -17,7 +17,7 @@
|
|||||||
- Why is my text output blurry?
|
- Why is my text output blurry?
|
||||||
- How can I load a different font than the default?
|
- How can I load a different font than the default?
|
||||||
- How can I load multiple fonts?
|
- How can I load multiple fonts?
|
||||||
- How can I display and input Chinese, Japanese, Korean characters?
|
- How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
||||||
- ISSUES & TODO-LIST
|
- ISSUES & TODO-LIST
|
||||||
- CODE
|
- CODE
|
||||||
- SAMPLE CODE
|
- SAMPLE CODE
|
||||||
@ -309,7 +309,8 @@
|
|||||||
// the first loaded font gets used by default
|
// the first loaded font gets used by default
|
||||||
// use ImGui::PushFont()/ImGui::PopFont() to change the font at runtime
|
// use ImGui::PushFont()/ImGui::PopFont() to change the font at runtime
|
||||||
|
|
||||||
Q: How can I render and input Chinese, Japanese, Korean characters?
|
|
||||||
|
Q: How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
||||||
A: When loading a font, pass custom Unicode ranges to specify the glyphs to load. ImGui will support UTF-8 encoding across the board.
|
A: When loading a font, pass custom Unicode ranges to specify the glyphs to load. ImGui will support UTF-8 encoding across the board.
|
||||||
Character input depends on you passing the right character code to io.AddInputCharacter(). The example applications do that.
|
Character input depends on you passing the right character code to io.AddInputCharacter(). The example applications do that.
|
||||||
|
|
||||||
@ -9737,6 +9738,19 @@ const ImWchar* ImFontAtlas::GetGlyphRangesJapanese()
|
|||||||
return &ranges[0];
|
return &ranges[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ImWchar* ImFontAtlas::GetGlyphRangesCyrillic()
|
||||||
|
{
|
||||||
|
static const ImWchar ranges[] =
|
||||||
|
{
|
||||||
|
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||||
|
0x0400, 0x052F, // Cyrillic + Cyrillic Supplement
|
||||||
|
0x2DE0, 0x2DFF, // Cyrillic Extended-A
|
||||||
|
0xA640, 0xA69F, // Cyrillic Extended-B
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
return &ranges[0];
|
||||||
|
}
|
||||||
|
|
||||||
void ImFont::BuildLookupTable()
|
void ImFont::BuildLookupTable()
|
||||||
{
|
{
|
||||||
int max_codepoint = 0;
|
int max_codepoint = 0;
|
||||||
|
1
imgui.h
1
imgui.h
@ -1089,6 +1089,7 @@ struct ImFontAtlas
|
|||||||
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
||||||
IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
|
IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
|
||||||
IMGUI_API const ImWchar* GetGlyphRangesChinese(); // Japanese + full set of about 21000 CJK Unified Ideographs
|
IMGUI_API const ImWchar* GetGlyphRangesChinese(); // Japanese + full set of about 21000 CJK Unified Ideographs
|
||||||
|
IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
// (Access texture data via GetTexData*() calls which will setup a default font for you.)
|
// (Access texture data via GetTexData*() calls which will setup a default font for you.)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user