OPENGL_GAL: avoid crash when esotheric unicode chars are used in netnames/pad names in Debug mode.
It happens when the char is not found in the font used to display netnames/pad names. When happens, a wxASSERT is raised. Unfortunately it can crash the application if it is during a paint event or some critical time.
This commit is contained in:
parent
576a0af293
commit
7be215249d
|
@ -1783,9 +1783,13 @@ int OPENGL_GAL::drawBitmapChar( unsigned long aChar )
|
|||
}
|
||||
|
||||
const FONT_GLYPH_TYPE* glyph = LookupGlyph( aChar );
|
||||
wxASSERT( glyph );
|
||||
|
||||
// If the glyph is not found (happens for many esotheric unicode chars)
|
||||
// shows a '?' instead.
|
||||
if( !glyph )
|
||||
glyph = LookupGlyph( '?' );
|
||||
|
||||
if( !glyph ) // Should not happen.
|
||||
return 0;
|
||||
|
||||
const float X = glyph->atlas_x + font_information.smooth_pixels;
|
||||
|
@ -1877,7 +1881,9 @@ std::pair<VECTOR2D, float> OPENGL_GAL::computeBitmapTextSize( const UTF8& aText
|
|||
|
||||
const FONT_GLYPH_TYPE* glyph = LookupGlyph( c );
|
||||
// Debug: show not coded char in the atlas
|
||||
wxASSERT_MSG( glyph, wxString::Format( "missing char in font: code 0x%x <%c>", c, c ) );
|
||||
// Be carefull before allowing the assert: it usually crash kicad
|
||||
// when the assert is made during a paint event.
|
||||
// wxASSERT_MSG( glyph, wxString::Format( "missing char in font: code 0x%x <%c>", c, c ) );
|
||||
|
||||
if( !glyph || // Not coded in font
|
||||
c == '-' || c == '_' ) // Strange size of these 2 chars
|
||||
|
|
Loading…
Reference in New Issue