@ -2222,13 +2222,11 @@ 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
const ImFontGlyph * glyph_fallback = font - > FallbackGlyph ; // Forcefully/dodgily make FindGlyph() return NULL on fallback, which isn't the default behavior.
font - > FallbackGlyph = NULL ;
for ( int base = 0 ; base < 0x10000 ; base + = 256 )
for ( int base = 0 ; base < 0x10000 ; base + = 256 )
{
{
int count = 0 ;
int count = 0 ;
for ( int n = 0 ; n < 256 ; n + + )
for ( int n = 0 ; n < 256 ; n + + )
count + = font - > FindGlyph ( ( ImWchar ) ( base + n ) ) ? 1 : 0 ;
count + = font - > FindGlyph NoFallback ( ( 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 " ) )
{
{
float cell_spacing = style . ItemSpacing . y ;
float cell_spacing = style . ItemSpacing . y ;
@ -2239,7 +2237,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
{
{
ImVec2 cell_p1 ( base_pos . x + ( n % 16 ) * ( cell_size . x + cell_spacing ) , base_pos . y + ( n / 16 ) * ( cell_size . y + cell_spacing ) ) ;
ImVec2 cell_p1 ( base_pos . x + ( n % 16 ) * ( cell_size . x + cell_spacing ) , base_pos . y + ( n / 16 ) * ( cell_size . y + cell_spacing ) ) ;
ImVec2 cell_p2 ( cell_p1 . x + cell_size . x , cell_p1 . y + cell_size . y ) ;
ImVec2 cell_p2 ( cell_p1 . x + cell_size . x , cell_p1 . y + cell_size . y ) ;
const ImFontGlyph * glyph = font - > FindGlyph ( ( ImWchar ) ( base + n ) ) ;
const ImFontGlyph * glyph = font - > FindGlyph NoFallback ( ( ImWchar ) ( base + n ) ) ;
draw_list - > AddRect ( cell_p1 , cell_p2 , glyph ? IM_COL32 ( 255 , 255 , 255 , 100 ) : IM_COL32 ( 255 , 255 , 255 , 50 ) ) ;
draw_list - > AddRect ( cell_p1 , cell_p2 , glyph ? IM_COL32 ( 255 , 255 , 255 , 100 ) : IM_COL32 ( 255 , 255 , 255 , 50 ) ) ;
font - > RenderChar ( draw_list , cell_size . x , cell_p1 , ImGui : : GetColorU32 ( ImGuiCol_Text ) , ( ImWchar ) ( base + n ) ) ; // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
font - > RenderChar ( draw_list , cell_size . x , cell_p1 , ImGui : : GetColorU32 ( ImGuiCol_Text ) , ( ImWchar ) ( base + n ) ) ; // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
if ( glyph & & ImGui : : IsMouseHoveringRect ( cell_p1 , cell_p2 ) )
if ( glyph & & ImGui : : IsMouseHoveringRect ( cell_p1 , cell_p2 ) )
@ -2257,7 +2255,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui : : TreePop ( ) ;
ImGui : : TreePop ( ) ;
}
}
}
}
font - > FallbackGlyph = glyph_fallback ;
ImGui : : TreePop ( ) ;
ImGui : : TreePop ( ) ;
}
}
ImGui : : TreePop ( ) ;
ImGui : : TreePop ( ) ;