mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
ImFont: Demo, Store Used4kPagesMap[] map in ImFont to facilitate iteration on all codepoints with a large value of IM_UNICODE_CODEPOINT_MAX. (#2815)
Demo uses IsGlyphRangeUnused()
This commit is contained in:
@ -3443,6 +3443,15 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
// Display all glyphs of the fonts in separate pages of 256 characters
|
||||
for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base += 256)
|
||||
{
|
||||
// Skip ahead if a large bunch of glyphs are not present in the font (test in chunks of 4k)
|
||||
// This is only a small optimization to reduce the number of iterations when IM_UNICODE_MAX_CODEPOINT is large.
|
||||
// (if ImWchar==ImWchar32 we will do at least about 272 queries here)
|
||||
if (!(base & 4095) && font->IsGlyphRangeUnused(base, base + 4095))
|
||||
{
|
||||
base += 4096 - 256;
|
||||
continue;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (unsigned int n = 0; n < 256; n++)
|
||||
count += font->FindGlyphNoFallback((ImWchar)(base + n)) ? 1 : 0;
|
||||
|
Reference in New Issue
Block a user