|
@@ -92,7 +92,7 @@ Index of this file:
|
|
|
#else
|
|
#else
|
|
|
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
|
|
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
|
|
|
#endif
|
|
#endif
|
|
|
-#define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Last Unicode code point supported by this build.
|
|
|
|
|
|
|
+#define IM_UNICODE_CODEPOINT_MAX (sizeof(ImWchar) == 2 ? 0xFFFF : 0x10FFFF) // Last Unicode code point supported by this build.
|
|
|
#define IM_UNICODE_CODEPOINT_INVALID 0xFFFD // Standard invalid Unicode code point.
|
|
#define IM_UNICODE_CODEPOINT_INVALID 0xFFFD // Standard invalid Unicode code point.
|
|
|
|
|
|
|
|
// Warnings
|
|
// Warnings
|
|
@@ -143,7 +143,11 @@ struct ImGuiTextFilter; // Helper to parse and apply text filters (e
|
|
|
typedef void* ImTextureID; // User data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp)
|
|
typedef void* ImTextureID; // User data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp)
|
|
|
#endif
|
|
#endif
|
|
|
typedef unsigned int ImGuiID; // Unique ID used by widgets (typically hashed from a stack of string)
|
|
typedef unsigned int ImGuiID; // Unique ID used by widgets (typically hashed from a stack of string)
|
|
|
-typedef unsigned short ImWchar; // A single U16 character for keyboard input/display. We encode them as multi bytes UTF-8 when used in strings.
|
|
|
|
|
|
|
+#ifndef ImWchar
|
|
|
|
|
+#define ImWchar ImWchar16
|
|
|
|
|
+#endif
|
|
|
|
|
+typedef unsigned short ImWchar16; // A single U16 character for keyboard input/display. We encode them as multi bytes UTF-8 when used in strings.
|
|
|
|
|
+typedef unsigned int ImWchar32; // A single U32 character for keyboard input/display. Define ImWchar to ImWchar32 to use it. See imconfig.h .
|
|
|
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling
|
|
typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling
|
|
|
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions
|
|
typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions
|
|
|
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
|
|
typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type
|
|
@@ -1465,6 +1469,7 @@ struct ImGuiIO
|
|
|
|
|
|
|
|
// Functions
|
|
// Functions
|
|
|
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
|
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
|
|
|
|
+ IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
|
|
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
|
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
|
|
IMGUI_API void ClearInputCharacters(); // Clear the text input buffer manually
|
|
IMGUI_API void ClearInputCharacters(); // Clear the text input buffer manually
|
|
|
|
|
|
|
@@ -1507,6 +1512,7 @@ struct ImGuiIO
|
|
|
float KeysDownDurationPrev[512]; // Previous duration the key has been down
|
|
float KeysDownDurationPrev[512]; // Previous duration the key has been down
|
|
|
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
|
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
|
|
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
|
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
|
|
|
|
+ ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
|
|
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform back-end). Fill using AddInputCharacter() helper.
|
|
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform back-end). Fill using AddInputCharacter() helper.
|
|
|
|
|
|
|
|
IMGUI_API ImGuiIO();
|
|
IMGUI_API ImGuiIO();
|
|
@@ -2091,11 +2097,11 @@ struct ImFontGlyphRangesBuilder
|
|
|
{
|
|
{
|
|
|
ImVector<ImU32> UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used)
|
|
ImVector<ImU32> UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used)
|
|
|
|
|
|
|
|
- ImFontGlyphRangesBuilder() { Clear(); }
|
|
|
|
|
- inline void Clear() { int size_in_bytes = (IM_UNICODE_CODEPOINT_MAX+1) / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); }
|
|
|
|
|
- inline bool GetBit(int n) const { int off = (n >> 5); ImU32 mask = 1u << (n & 31); return (UsedChars[off] & mask) != 0; } // Get bit n in the array
|
|
|
|
|
- inline void SetBit(int n) { int off = (n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array
|
|
|
|
|
- inline void AddChar(ImWchar c) { SetBit(c); } // Add character
|
|
|
|
|
|
|
+ ImFontGlyphRangesBuilder() { Clear(); }
|
|
|
|
|
+ inline void Clear() { int size_in_bytes = (IM_UNICODE_CODEPOINT_MAX + 1) / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); }
|
|
|
|
|
+ inline bool GetBit(size_t n) const { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); return (UsedChars[off] & mask) != 0; } // Get bit n in the array
|
|
|
|
|
+ inline void SetBit(size_t n) { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array
|
|
|
|
|
+ inline 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 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 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
|
|
IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges); // Output new ranges
|
|
@@ -2251,6 +2257,7 @@ struct ImFont
|
|
|
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
|
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
|
|
float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
|
float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
|
|
int MetricsTotalSurface;// 4 // out // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
|
int MetricsTotalSurface;// 4 // out // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
|
|
|
|
+ ImU8 Used4kPagesMap[(IM_UNICODE_CODEPOINT_MAX+1)/4096/8]; // 2 bytes if ImWchar=ImWchar16, 34 bytes if ImWchar==ImWchar32. Store 1-bit for each block of 4K codepoints that has one active glyph. This is mainly used to facilitate iterations accross all used codepoints.
|
|
|
|
|
|
|
|
// Methods
|
|
// Methods
|
|
|
IMGUI_API ImFont();
|
|
IMGUI_API ImFont();
|
|
@@ -2276,6 +2283,7 @@ struct ImFont
|
|
|
IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.
|
|
IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.
|
|
|
IMGUI_API void SetGlyphVisible(ImWchar c, bool visible);
|
|
IMGUI_API void SetGlyphVisible(ImWchar c, bool visible);
|
|
|
IMGUI_API void SetFallbackChar(ImWchar c);
|
|
IMGUI_API void SetFallbackChar(ImWchar c);
|
|
|
|
|
+ IMGUI_API bool IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
#if defined(__clang__)
|
|
#if defined(__clang__)
|