mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-30 18:34:34 +01:00
Added IM_UNICODE_CODEPOINT_MAX. Changed specs of ImFontAtlas::AddCustomRectRegular() (breaking change).
This commit is contained in:
parent
ca63349eb4
commit
51a02b319c
@ -52,6 +52,8 @@ Breaking Changes:
|
|||||||
If you never altered io.KeyRepeatRate nor used GetKeyPressedAmount() this won't affect you.
|
If you never altered io.KeyRepeatRate nor used GetKeyPressedAmount() this won't affect you.
|
||||||
- Misc: Renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS. (#1038)
|
- Misc: Renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS. (#1038)
|
||||||
- Misc: Renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS.
|
- Misc: Renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS.
|
||||||
|
- Fonts: ImFontAtlas::AddCustomRectRegular() now requires an ID larger than 0x110000 (instead of 0x10000) to
|
||||||
|
conform with supporting Unicode planes 1-16 in a future update. ID below 0x110000 will now assert.
|
||||||
- Backends: DX12: Added extra ID3D12DescriptorHeap parameter to ImGui_ImplDX12_Init() function.
|
- Backends: DX12: Added extra ID3D12DescriptorHeap parameter to ImGui_ImplDX12_Init() function.
|
||||||
The value is unused in master branch but will be used by the multi-viewport feature. (#2851) [@obfuscate]
|
The value is unused in master branch but will be used by the multi-viewport feature. (#2851) [@obfuscate]
|
||||||
|
|
||||||
|
15
imgui.cpp
15
imgui.cpp
@ -353,6 +353,7 @@ CODE
|
|||||||
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
|
- 2019/11/21 (1.74) - ImFontAtlas::AddCustomRectRegular() now requires an ID larger than 0x110000 (instead of 0x10000) to conform with supporting Unicode planes 1-16 in a future update. ID below 0x110000 will now assert.
|
||||||
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS for consistency.
|
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS for consistency.
|
||||||
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS for consistency.
|
- 2019/11/19 (1.74) - renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS for consistency.
|
||||||
- 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. See docs/Changelog.txt or grep this log for details and new names, or see how they were implemented until 1.73.
|
- 2019/10/22 (1.74) - removed redirecting functions/enums that were marked obsolete in 1.52 (October 2017): Begin() (5 arguments signature), IsRootWindowOrAnyChildHovered(), AlignFirstTextHeightToWidgets(), SetNextWindowPosCenter(), ImFont::Glyph. See docs/Changelog.txt or grep this log for details and new names, or see how they were implemented until 1.73.
|
||||||
@ -1061,7 +1062,7 @@ ImGuiIO::ImGuiIO()
|
|||||||
// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message
|
// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message
|
||||||
void ImGuiIO::AddInputCharacter(unsigned int c)
|
void ImGuiIO::AddInputCharacter(unsigned int c)
|
||||||
{
|
{
|
||||||
if (c > 0 && c < 0x10000)
|
if (c > 0 && c <= IM_UNICODE_CODEPOINT_MAX)
|
||||||
InputQueueCharacters.push_back((ImWchar)c);
|
InputQueueCharacters.push_back((ImWchar)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1071,7 +1072,7 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
|
|||||||
{
|
{
|
||||||
unsigned int c = 0;
|
unsigned int c = 0;
|
||||||
utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL);
|
utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL);
|
||||||
if (c > 0 && c < 0x10000)
|
if (c > 0 && c <= IM_UNICODE_CODEPOINT_MAX)
|
||||||
InputQueueCharacters.push_back((ImWchar)c);
|
InputQueueCharacters.push_back((ImWchar)c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1463,7 +1464,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char*
|
|||||||
}
|
}
|
||||||
if ((*str & 0xe0) == 0xc0)
|
if ((*str & 0xe0) == 0xc0)
|
||||||
{
|
{
|
||||||
*out_char = 0xFFFD; // will be invalid but not end of string
|
*out_char = IM_UNICODE_CODEPOINT_INVALID; // will be invalid but not end of string
|
||||||
if (in_text_end && in_text_end - (const char*)str < 2) return 1;
|
if (in_text_end && in_text_end - (const char*)str < 2) return 1;
|
||||||
if (*str < 0xc2) return 2;
|
if (*str < 0xc2) return 2;
|
||||||
c = (unsigned int)((*str++ & 0x1f) << 6);
|
c = (unsigned int)((*str++ & 0x1f) << 6);
|
||||||
@ -1474,7 +1475,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char*
|
|||||||
}
|
}
|
||||||
if ((*str & 0xf0) == 0xe0)
|
if ((*str & 0xf0) == 0xe0)
|
||||||
{
|
{
|
||||||
*out_char = 0xFFFD; // will be invalid but not end of string
|
*out_char = IM_UNICODE_CODEPOINT_INVALID; // will be invalid but not end of string
|
||||||
if (in_text_end && in_text_end - (const char*)str < 3) return 1;
|
if (in_text_end && in_text_end - (const char*)str < 3) return 1;
|
||||||
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3;
|
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3;
|
||||||
if (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below
|
if (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below
|
||||||
@ -1488,7 +1489,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char*
|
|||||||
}
|
}
|
||||||
if ((*str & 0xf8) == 0xf0)
|
if ((*str & 0xf8) == 0xf0)
|
||||||
{
|
{
|
||||||
*out_char = 0xFFFD; // will be invalid but not end of string
|
*out_char = IM_UNICODE_CODEPOINT_INVALID; // will be invalid but not end of string
|
||||||
if (in_text_end && in_text_end - (const char*)str < 4) return 1;
|
if (in_text_end && in_text_end - (const char*)str < 4) return 1;
|
||||||
if (*str > 0xf4) return 4;
|
if (*str > 0xf4) return 4;
|
||||||
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4;
|
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4;
|
||||||
@ -1519,7 +1520,7 @@ int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const cha
|
|||||||
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
break;
|
break;
|
||||||
if (c < 0x10000) // FIXME: Losing characters that don't fit in 2 bytes
|
if (c <= IM_UNICODE_CODEPOINT_MAX) // FIXME: Losing characters that don't fit in 2 bytes
|
||||||
*buf_out++ = (ImWchar)c;
|
*buf_out++ = (ImWchar)c;
|
||||||
}
|
}
|
||||||
*buf_out = 0;
|
*buf_out = 0;
|
||||||
@ -1537,7 +1538,7 @@ int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end)
|
|||||||
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
break;
|
break;
|
||||||
if (c < 0x10000)
|
if (c <= IM_UNICODE_CODEPOINT_MAX)
|
||||||
char_count++;
|
char_count++;
|
||||||
}
|
}
|
||||||
return char_count;
|
return char_count;
|
||||||
|
16
imgui.h
16
imgui.h
@ -80,6 +80,8 @@ 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_INVALID 0xFFFD // Standard invalid Unicode code point.
|
||||||
|
|
||||||
// Warnings
|
// Warnings
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
@ -2045,7 +2047,7 @@ 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(); }
|
ImFontGlyphRangesBuilder() { Clear(); }
|
||||||
inline void Clear() { int size_in_bytes = 0x10000 / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); }
|
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 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 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
|
inline void AddChar(ImWchar c) { SetBit(c); } // Add character
|
||||||
@ -2057,12 +2059,12 @@ struct ImFontGlyphRangesBuilder
|
|||||||
// See ImFontAtlas::AddCustomRectXXX functions.
|
// See ImFontAtlas::AddCustomRectXXX functions.
|
||||||
struct ImFontAtlasCustomRect
|
struct ImFontAtlasCustomRect
|
||||||
{
|
{
|
||||||
unsigned int ID; // Input // User ID. Use <0x10000 to map into a font glyph, >=0x10000 for other/internal/custom texture data.
|
unsigned int ID; // Input // User ID. Use < 0x110000 to map into a font glyph, >= 0x110000 for other/internal/custom texture data.
|
||||||
unsigned short Width, Height; // Input // Desired rectangle dimension
|
unsigned short Width, Height; // Input // Desired rectangle dimension
|
||||||
unsigned short X, Y; // Output // Packed position in Atlas
|
unsigned short X, Y; // Output // Packed position in Atlas
|
||||||
float GlyphAdvanceX; // Input // For custom font glyphs only (ID<0x10000): glyph xadvance
|
float GlyphAdvanceX; // Input // For custom font glyphs only (ID < 0x110000): glyph xadvance
|
||||||
ImVec2 GlyphOffset; // Input // For custom font glyphs only (ID<0x10000): glyph display offset
|
ImVec2 GlyphOffset; // Input // For custom font glyphs only (ID < 0x110000): glyph display offset
|
||||||
ImFont* Font; // Input // For custom font glyphs only (ID<0x10000): target font
|
ImFont* Font; // Input // For custom font glyphs only (ID < 0x110000): target font
|
||||||
ImFontAtlasCustomRect() { ID = 0xFFFFFFFF; Width = Height = 0; X = Y = 0xFFFF; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0,0); Font = NULL; }
|
ImFontAtlasCustomRect() { ID = 0xFFFFFFFF; Width = Height = 0; X = Y = 0xFFFF; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0,0); Font = NULL; }
|
||||||
bool IsPacked() const { return X != 0xFFFF; }
|
bool IsPacked() const { return X != 0xFFFF; }
|
||||||
};
|
};
|
||||||
@ -2142,8 +2144,8 @@ struct ImFontAtlas
|
|||||||
// You can also request your rectangles to be mapped as font glyph (given a font + Unicode point),
|
// You can also request your rectangles to be mapped as font glyph (given a font + Unicode point),
|
||||||
// so you can render e.g. custom colorful icons and use them as regular glyphs.
|
// so you can render e.g. custom colorful icons and use them as regular glyphs.
|
||||||
// Read misc/fonts/README.txt for more details about using colorful icons.
|
// Read misc/fonts/README.txt for more details about using colorful icons.
|
||||||
IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList
|
IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x110000. Id >= 0x80000000 are reserved for ImGui and ImDrawList
|
||||||
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x10000 to register a rectangle to map into a specific font.
|
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x110000 to register a rectangle to map into a specific font.
|
||||||
const ImFontAtlasCustomRect*GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
const ImFontAtlasCustomRect*GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
|
@ -3416,10 +3416,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
||||||
{
|
{
|
||||||
// Display all glyphs of the fonts in separate pages of 256 characters
|
// Display all glyphs of the fonts in separate pages of 256 characters
|
||||||
for (int base = 0; base < 0x10000; base += 256)
|
for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base += 256)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int n = 0; n < 256; n++)
|
for (unsigned int n = 0; n < 256; n++)
|
||||||
count += font->FindGlyphNoFallback((ImWchar)(base + n)) ? 1 : 0;
|
count += font->FindGlyphNoFallback((ImWchar)(base + n)) ? 1 : 0;
|
||||||
if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base + 255, count, count > 1 ? "glyphs" : "glyph"))
|
if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base + 255, count, count > 1 ? "glyphs" : "glyph"))
|
||||||
{
|
{
|
||||||
@ -3427,7 +3427,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
float cell_spacing = style.ItemSpacing.y;
|
float cell_spacing = style.ItemSpacing.y;
|
||||||
ImVec2 base_pos = ImGui::GetCursorScreenPos();
|
ImVec2 base_pos = ImGui::GetCursorScreenPos();
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
for (int n = 0; n < 256; n++)
|
for (unsigned int n = 0; n < 256; n++)
|
||||||
{
|
{
|
||||||
ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));
|
ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));
|
||||||
ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);
|
ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);
|
||||||
|
@ -1725,7 +1725,8 @@ ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed
|
|||||||
|
|
||||||
int ImFontAtlas::AddCustomRectRegular(unsigned int id, int width, int height)
|
int ImFontAtlas::AddCustomRectRegular(unsigned int id, int width, int height)
|
||||||
{
|
{
|
||||||
IM_ASSERT(id >= 0x10000);
|
// Breaking change on 2019/11/21 (1.74): ImFontAtlas::AddCustomRectRegular() now requires an ID >= 0x110000 (instead of >= 0x10000)
|
||||||
|
IM_ASSERT(id >= 0x110000);
|
||||||
IM_ASSERT(width > 0 && width <= 0xFFFF);
|
IM_ASSERT(width > 0 && width <= 0xFFFF);
|
||||||
IM_ASSERT(height > 0 && height <= 0xFFFF);
|
IM_ASSERT(height > 0 && height <= 0xFFFF);
|
||||||
ImFontAtlasCustomRect r;
|
ImFontAtlasCustomRect r;
|
||||||
@ -1905,7 +1906,7 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
dst_tmp.GlyphsSet.Resize(dst_tmp.GlyphsHighest + 1);
|
dst_tmp.GlyphsSet.Resize(dst_tmp.GlyphsHighest + 1);
|
||||||
|
|
||||||
for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2)
|
for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2)
|
||||||
for (int codepoint = src_range[0]; codepoint <= src_range[1]; codepoint++)
|
for (unsigned int codepoint = src_range[0]; codepoint <= src_range[1]; codepoint++)
|
||||||
{
|
{
|
||||||
if (dst_tmp.GlyphsSet.GetBit(codepoint)) // Don't overwrite existing glyphs. We could make this an option for MergeMode (e.g. MergeOverwrite==true)
|
if (dst_tmp.GlyphsSet.GetBit(codepoint)) // Don't overwrite existing glyphs. We could make this an option for MergeMode (e.g. MergeOverwrite==true)
|
||||||
continue;
|
continue;
|
||||||
@ -2189,7 +2190,7 @@ void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
|
|||||||
for (int i = 0; i < atlas->CustomRects.Size; i++)
|
for (int i = 0; i < atlas->CustomRects.Size; i++)
|
||||||
{
|
{
|
||||||
const ImFontAtlasCustomRect& r = atlas->CustomRects[i];
|
const ImFontAtlasCustomRect& r = atlas->CustomRects[i];
|
||||||
if (r.Font == NULL || r.ID > 0x10000)
|
if (r.Font == NULL || r.ID >= 0x110000)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IM_ASSERT(r.Font->ContainerAtlas == atlas);
|
IM_ASSERT(r.Font->ContainerAtlas == atlas);
|
||||||
@ -2453,7 +2454,7 @@ void ImFontGlyphRangesBuilder::AddText(const char* text, const char* text_end)
|
|||||||
text += c_len;
|
text += c_len;
|
||||||
if (c_len == 0)
|
if (c_len == 0)
|
||||||
break;
|
break;
|
||||||
if (c < 0x10000)
|
if (c <= IM_UNICODE_CODEPOINT_MAX)
|
||||||
AddChar((ImWchar)c);
|
AddChar((ImWchar)c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2467,12 +2468,12 @@ void ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges)
|
|||||||
|
|
||||||
void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)
|
void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)
|
||||||
{
|
{
|
||||||
int max_codepoint = 0x10000;
|
const int max_codepoint = IM_UNICODE_CODEPOINT_MAX;
|
||||||
for (int n = 0; n < max_codepoint; n++)
|
for (int n = 0; n <= max_codepoint; n++)
|
||||||
if (GetBit(n))
|
if (GetBit(n))
|
||||||
{
|
{
|
||||||
out_ranges->push_back((ImWchar)n);
|
out_ranges->push_back((ImWchar)n);
|
||||||
while (n < max_codepoint - 1 && GetBit(n + 1))
|
while (n < max_codepoint && GetBit(n + 1))
|
||||||
n++;
|
n++;
|
||||||
out_ranges->push_back((ImWchar)n);
|
out_ranges->push_back((ImWchar)n);
|
||||||
}
|
}
|
||||||
@ -2601,7 +2602,7 @@ void ImFont::AddGlyph(ImWchar codepoint, float x0, float y0, float x1, float y1,
|
|||||||
void ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst)
|
void ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst)
|
||||||
{
|
{
|
||||||
IM_ASSERT(IndexLookup.Size > 0); // Currently this can only be called AFTER the font has been built, aka after calling ImFontAtlas::GetTexDataAs*() function.
|
IM_ASSERT(IndexLookup.Size > 0); // Currently this can only be called AFTER the font has been built, aka after calling ImFontAtlas::GetTexDataAs*() function.
|
||||||
int index_size = IndexLookup.Size;
|
unsigned int index_size = (unsigned int)IndexLookup.Size;
|
||||||
|
|
||||||
if (dst < index_size && IndexLookup.Data[dst] == (ImWchar)-1 && !overwrite_dst) // 'dst' already exists
|
if (dst < index_size && IndexLookup.Data[dst] == (ImWchar)-1 && !overwrite_dst) // 'dst' already exists
|
||||||
return;
|
return;
|
||||||
|
@ -3157,7 +3157,7 @@ namespace ImStb
|
|||||||
static int STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING* obj) { return obj->CurLenW; }
|
static int STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING* obj) { return obj->CurLenW; }
|
||||||
static ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING* obj, int idx) { return obj->TextW[idx]; }
|
static ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING* obj, int idx) { return obj->TextW[idx]; }
|
||||||
static float STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *GImGui; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); }
|
static float STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *GImGui; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); }
|
||||||
static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x10000 ? 0 : key; }
|
static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x200000 ? 0 : key; }
|
||||||
static ImWchar STB_TEXTEDIT_NEWLINE = '\n';
|
static ImWchar STB_TEXTEDIT_NEWLINE = '\n';
|
||||||
static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* obj, int line_start_idx)
|
static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* obj, int line_start_idx)
|
||||||
{
|
{
|
||||||
@ -3340,6 +3340,10 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
|||||||
if (c >= 0xE000 && c <= 0xF8FF)
|
if (c >= 0xE000 && c <= 0xF8FF)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Filter Unicode ranges we are not handling in this build.
|
||||||
|
if (c > IM_UNICODE_CODEPOINT_MAX)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Generic named filters
|
// Generic named filters
|
||||||
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific))
|
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific))
|
||||||
{
|
{
|
||||||
@ -3763,7 +3767,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
s += ImTextCharFromUtf8(&c, s, NULL);
|
s += ImTextCharFromUtf8(&c, s, NULL);
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
break;
|
break;
|
||||||
if (c >= 0x10000 || !InputTextFilterCharacter(&c, flags, callback, callback_user_data))
|
if (!InputTextFilterCharacter(&c, flags, callback, callback_user_data))
|
||||||
continue;
|
continue;
|
||||||
clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c;
|
clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user