@ -2622,6 +2622,7 @@ void ImFont::BuildLookupTable() 
			
		
	
		
		
			
				
					
					    for  ( int  i  =  0 ;  i  ! =  Glyphs . Size ;  i + + )      for  ( int  i  =  0 ;  i  ! =  Glyphs . Size ;  i + + )   
			
		
	
		
		
			
				
					
					        max_codepoint  =  ImMax ( max_codepoint ,  ( int ) Glyphs [ i ] . Codepoint ) ;          max_codepoint  =  ImMax ( max_codepoint ,  ( int ) Glyphs [ i ] . Codepoint ) ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    // Build lookup table
   
			
		
	
		
		
			
				
					
					    IM_ASSERT ( Glyphs . Size  <  0xFFFF ) ;  // -1 is reserved
      IM_ASSERT ( Glyphs . Size  <  0xFFFF ) ;  // -1 is reserved
   
			
		
	
		
		
			
				
					
					    IndexAdvanceX . clear ( ) ;      IndexAdvanceX . clear ( ) ;   
			
		
	
		
		
			
				
					
					    IndexLookup . clear ( ) ;      IndexLookup . clear ( ) ;   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -2638,7 +2639,7 @@ void ImFont::BuildLookupTable() 
			
		
	
		
		
			
				
					
					    // FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at "column 0" ?)
      // FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at "column 0" ?)
   
			
		
	
		
		
			
				
					
					    if  ( FindGlyph ( ( ImWchar ) '   ' ) )      if  ( FindGlyph ( ( ImWchar ) '   ' ) )   
			
		
	
		
		
			
				
					
					    {      {   
			
		
	
		
		
			
				
					
					        if  ( Glyphs . back ( ) . Codepoint  ! =  ' \t ' )    // So we can call this function multiple times
          if  ( Glyphs . back ( ) . Codepoint  ! =  ' \t ' )    // So we can call this function multiple times (FIXME: Flaky) 
   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					            Glyphs . resize ( Glyphs . Size  +  1 ) ;              Glyphs . resize ( Glyphs . Size  +  1 ) ;   
			
		
	
		
		
			
				
					
					        ImFontGlyph &  tab_glyph  =  Glyphs . back ( ) ;          ImFontGlyph &  tab_glyph  =  Glyphs . back ( ) ;   
			
		
	
		
		
			
				
					
					        tab_glyph  =  * FindGlyph ( ( ImWchar ) '   ' ) ;          tab_glyph  =  * FindGlyph ( ( ImWchar ) '   ' ) ;   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -2648,6 +2649,11 @@ void ImFont::BuildLookupTable() 
			
		
	
		
		
			
				
					
					        IndexLookup [ ( int ) tab_glyph . Codepoint ]  =  ( ImWchar ) ( Glyphs . Size - 1 ) ;          IndexLookup [ ( int ) tab_glyph . Codepoint ]  =  ( ImWchar ) ( Glyphs . Size - 1 ) ;   
			
		
	
		
		
			
				
					
					    }      }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    // Mark special glyphs as not visible (note that AddGlyph already mark as non-visible glyphs with zero-size polygons)
   
			
		
	
		
		
			
				
					
					    SetGlyphVisible ( ( ImWchar ) '   ' ,  false ) ;   
			
		
	
		
		
			
				
					
					    SetGlyphVisible ( ( ImWchar ) ' \t ' ,  false ) ;   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    // Setup fall-backs
   
			
		
	
		
		
			
				
					
					    FallbackGlyph  =  FindGlyphNoFallback ( FallbackChar ) ;      FallbackGlyph  =  FindGlyphNoFallback ( FallbackChar ) ;   
			
		
	
		
		
			
				
					
					    FallbackAdvanceX  =  FallbackGlyph  ?  FallbackGlyph - > AdvanceX  :  0.0f ;      FallbackAdvanceX  =  FallbackGlyph  ?  FallbackGlyph - > AdvanceX  :  0.0f ;   
			
		
	
		
		
			
				
					
					    for  ( int  i  =  0 ;  i  <  max_codepoint  +  1 ;  i + + )      for  ( int  i  =  0 ;  i  <  max_codepoint  +  1 ;  i + + )   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -2655,6 +2661,12 @@ void ImFont::BuildLookupTable() 
			
		
	
		
		
			
				
					
					            IndexAdvanceX [ i ]  =  FallbackAdvanceX ;              IndexAdvanceX [ i ]  =  FallbackAdvanceX ;   
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					void  ImFont : : SetGlyphVisible ( ImWchar  c ,  bool  visible )  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    if  ( ImFontGlyph *  glyph  =  ( ImFontGlyph * ) ( void * ) FindGlyph ( ( ImWchar ) c ) )   
			
		
	
		
		
			
				
					
					        glyph - > Visible  =  visible  ?  1  :  0 ;   
			
		
	
		
		
			
				
					
					}  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					void  ImFont : : SetFallbackChar ( ImWchar  c ) void  ImFont : : SetFallbackChar ( ImWchar  c )  
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    FallbackChar  =  c ;      FallbackChar  =  c ;   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -2676,7 +2688,8 @@ void ImFont::AddGlyph(ImWchar codepoint, float x0, float y0, float x1, float y1, 
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    Glyphs . resize ( Glyphs . Size  +  1 ) ;      Glyphs . resize ( Glyphs . Size  +  1 ) ;   
			
		
	
		
		
			
				
					
					    ImFontGlyph &  glyph  =  Glyphs . back ( ) ;      ImFontGlyph &  glyph  =  Glyphs . back ( ) ;   
			
		
	
		
		
			
				
					
					    glyph . Codepoint  =  ( ImWchar ) codepoint ;      glyph . Codepoint  =  ( unsigned  int ) codepoint ;   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					    glyph . Visible  =  ( x0  ! =  x1 )  & &  ( y0  ! =  y1 ) ;   
			
		
	
		
		
			
				
					
					    glyph . X0  =  x0 ;      glyph . X0  =  x0 ;   
			
		
	
		
		
			
				
					
					    glyph . Y0  =  y0 ;      glyph . Y0  =  y0 ;   
			
		
	
		
		
			
				
					
					    glyph . X1  =  x1 ;      glyph . X1  =  x1 ;   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -2925,16 +2938,14 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					void  ImFont : : RenderChar ( ImDrawList *  draw_list ,  float  size ,  ImVec2  pos ,  ImU32  col ,  ImWchar  c )  const void  ImFont : : RenderChar ( ImDrawList *  draw_list ,  float  size ,  ImVec2  pos ,  ImU32  col ,  ImWchar  c )  const  
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    if  ( c  = =  '   '  | |  c  = =  ' \t '  | |  c  = =  ' \n '  | |  c  = =  ' \r ' )  // Match behavior of RenderText(), those 4 codepoints are hard-coded.
      const  ImFontGlyph *  glyph  =  FindGlyph ( c ) ;   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					    if  ( ! glyph  | |  ! glyph - > Visible )   
			
		
	
		
		
			
				
					
					        return ;          return ;   
			
		
	
		
		
			
				
					
					    if  ( const  ImFontGlyph *  glyph  =  FindGlyph ( c ) )   
			
		
	
		
		
			
				
					
					    {   
			
		
	
		
		
			
				
					
					    float  scale  =  ( size  > =  0.0f )  ?  ( size  /  FontSize )  :  1.0f ;      float  scale  =  ( size  > =  0.0f )  ?  ( size  /  FontSize )  :  1.0f ;   
			
		
	
		
		
			
				
					
					    pos . x  =  IM_FLOOR ( pos . x  +  DisplayOffset . x ) ;      pos . x  =  IM_FLOOR ( pos . x  +  DisplayOffset . x ) ;   
			
		
	
		
		
			
				
					
					    pos . y  =  IM_FLOOR ( pos . y  +  DisplayOffset . y ) ;      pos . y  =  IM_FLOOR ( pos . y  +  DisplayOffset . y ) ;   
			
		
	
		
		
			
				
					
					    draw_list - > PrimReserve ( 6 ,  4 ) ;      draw_list - > PrimReserve ( 6 ,  4 ) ;   
			
		
	
		
		
			
				
					
					    draw_list - > PrimRectUV ( ImVec2 ( pos . x  +  glyph - > X0  *  scale ,  pos . y  +  glyph - > Y0  *  scale ) ,  ImVec2 ( pos . x  +  glyph - > X1  *  scale ,  pos . y  +  glyph - > Y1  *  scale ) ,  ImVec2 ( glyph - > U0 ,  glyph - > V0 ) ,  ImVec2 ( glyph - > U1 ,  glyph - > V1 ) ,  col ) ;      draw_list - > PrimRectUV ( ImVec2 ( pos . x  +  glyph - > X0  *  scale ,  pos . y  +  glyph - > Y0  *  scale ) ,  ImVec2 ( pos . x  +  glyph - > X1  *  scale ,  pos . y  +  glyph - > Y1  *  scale ) ,  ImVec2 ( glyph - > U0 ,  glyph - > V0 ) ,  ImVec2 ( glyph - > U1 ,  glyph - > V1 ) ,  col ) ;   
			
		
	
		
		
			
				
					
					    }   
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					void  ImFont : : RenderText ( ImDrawList *  draw_list ,  float  size ,  ImVec2  pos ,  ImU32  col ,  const  ImVec4 &  clip_rect ,  const  char *  text_begin ,  const  char *  text_end ,  float  wrap_width ,  bool  cpu_fine_clip )  const void  ImFont : : RenderText ( ImDrawList *  draw_list ,  float  size ,  ImVec2  pos ,  ImU32  col ,  const  ImVec4 &  clip_rect ,  const  char *  text_begin ,  const  char *  text_end ,  float  wrap_width ,  bool  cpu_fine_clip )  const  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -3047,13 +3058,12 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col 
			
		
	
		
		
			
				
					
					                continue ;                  continue ;   
			
		
	
		
		
			
				
					
					        }          }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        float  char_width  =  0.0f ;          const  ImFontGlyph *  glyph  =  FindGlyph ( ( ImWchar ) c ) ;   
			
				
				
			
		
	
		
		
			
				
					
					        if  ( const  ImFontGlyph *  glyph  =  FindGlyph ( ( ImWchar ) c ) )          if  ( glyph  = =  NULL )   
			
				
				
			
		
	
		
		
			
				
					
					        {              continue ;   
			
				
				
			
		
	
		
		
			
				
					
					            char_width  =  glyph - > AdvanceX  *  scale ;   
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					            // Arbitrarily assume that both space and tabs are empty glyphs as an optimization
           float  char_width  =  glyph - > AdvanceX  *  scale ;   
			
				
				
			
		
	
		
		
			
				
					
					             if  ( c  ! =  '   '  & &  c  ! =  ' \t ' )          if  ( glyph - > Visible )   
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					        {          {   
			
		
	
		
		
			
				
					
					            // We don't do a second finer clipping test on the Y axis as we've already skipped anything before clip_rect.y and exit once we pass clip_rect.w
              // We don't do a second finer clipping test on the Y axis as we've already skipped anything before clip_rect.y and exit once we pass clip_rect.w
   
			
		
	
		
		
			
				
					
					            float  x1  =  x  +  glyph - > X0  *  scale ;              float  x1  =  x  +  glyph - > X0  *  scale ;   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -3112,8 +3122,6 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col 
			
		
	
		
		
			
				
					
					                }                  }   
			
		
	
		
		
			
				
					
					            }              }   
			
		
	
		
		
			
				
					
					        }          }   
			
		
	
		
		
			
				
					
					        }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        x  + =  char_width ;          x  + =  char_width ;   
			
		
	
		
		
			
				
					
					    }      }