|
@@ -1350,7 +1350,7 @@ struct ImFontAtlas
|
|
void SetTexID(ImTextureID id) { TexID = id; }
|
|
void SetTexID(ImTextureID id) { TexID = id; }
|
|
|
|
|
|
// Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)
|
|
// Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)
|
|
- // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create a UTF-8 string literally using the u8"Hello world" syntax. See FAQ for details.
|
|
|
|
|
|
+ // 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.
|
|
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
|
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
|
IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters
|
|
IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters
|
|
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
|
|
@@ -1358,6 +1358,19 @@ struct ImFontAtlas
|
|
IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters
|
|
IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters
|
|
IMGUI_API const ImWchar* GetGlyphRangesThai(); // Default + Thai characters
|
|
IMGUI_API const ImWchar* GetGlyphRangesThai(); // Default + Thai characters
|
|
|
|
|
|
|
|
+ // Helpers to build glyph ranges from text data. Feed all your application strings/characters to it then call BuildRanges().
|
|
|
|
+ struct GlyphRangesBuilder
|
|
|
|
+ {
|
|
|
|
+ ImVector<unsigned char> UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used)
|
|
|
|
+ GlyphRangesBuilder() { UsedChars.resize(0x10000 / 8); memset(UsedChars.Data, 0, 0x10000 / 8); }
|
|
|
|
+ bool GetBit(int n) { return (UsedChars[n >> 3] & (1 << (n & 7))) != 0; }
|
|
|
|
+ void SetBit(int n) { UsedChars[n >> 3] |= 1 << (n & 7); } // Set bit 'c' in the array
|
|
|
|
+ void AddChar(ImWchar c) { SetBit(c); } // Add character
|
|
|
|
+ IMGUI_API void AddText(const char* text, const char* text_end = NULL); // Add string (each character of the UTF-8 string are added)
|
|
|
|
+ IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault) to force add all of ASCII/Latin+Ext
|
|
|
|
+ IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges); // Output new ranges
|
|
|
|
+ };
|
|
|
|
+
|
|
// 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.)
|
|
ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure.
|
|
ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure.
|