mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-14 17:07:01 +00:00
Tweak GetGlyphRangesJapanese() to it is easier to modify
This commit is contained in:
parent
94ec3d534e
commit
3aebddc4ac
@ -1533,25 +1533,27 @@ const ImWchar* ImFontAtlas::GetGlyphRangesJapanese()
|
||||
19,3,8,0,0,0,4,4,16,0,4,1,5,1,3,0,3,4,6,2,17,10,10,31,6,4,3,6,10,126,7,3,2,2,0,9,0,0,5,20,13,0,15,0,6,0,2,5,8,64,50,3,2,12,2,9,0,0,11,8,20,
|
||||
109,2,18,23,0,0,9,61,3,0,28,41,77,27,19,17,81,5,2,14,5,83,57,252,14,154,263,14,20,8,13,6,57,39,38,
|
||||
};
|
||||
static int ranges_unpacked = false;
|
||||
static ImWchar ranges[8 + IM_ARRAYSIZE(offsets_from_0x4E00)*2 + 1] =
|
||||
static ImWchar base_ranges[] =
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x3000, 0x30FF, // Punctuations, Hiragana, Katakana
|
||||
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
||||
0xFF00, 0xFFEF, // Half-width characters
|
||||
};
|
||||
if (!ranges_unpacked)
|
||||
static bool full_ranges_unpacked = false;
|
||||
static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(offsets_from_0x4E00)*2 + 1];
|
||||
if (!full_ranges_unpacked)
|
||||
{
|
||||
// Unpack
|
||||
int codepoint = 0x4e00;
|
||||
ImWchar* dst = &ranges[8];
|
||||
memcpy(full_ranges, base_ranges, sizeof(base_ranges));
|
||||
ImWchar* dst = full_ranges + IM_ARRAYSIZE(base_ranges);;
|
||||
for (int n = 0; n < IM_ARRAYSIZE(offsets_from_0x4E00); n++, dst += 2)
|
||||
dst[0] = dst[1] = (ImWchar)(codepoint += (offsets_from_0x4E00[n] + 1));
|
||||
dst[0] = 0;
|
||||
ranges_unpacked = true;
|
||||
full_ranges_unpacked = true;
|
||||
}
|
||||
return &ranges[0];
|
||||
return &full_ranges[0];
|
||||
}
|
||||
|
||||
const ImWchar* ImFontAtlas::GetGlyphRangesCyrillic()
|
||||
|
Loading…
Reference in New Issue
Block a user