Change current font only if new graphics font is successfully created
If new graphics font couldn't be created successfully there is no need to reset current font by updating it to wxNullGraphicsFont. Closes #17790.
This commit is contained in:
@@ -653,12 +653,21 @@ void wxGraphicsContext::SetFont( const wxGraphicsFont& font )
|
||||
m_font = font;
|
||||
}
|
||||
|
||||
void wxGraphicsContext::SetFont( const wxFont& font, const wxColour& colour )
|
||||
void wxGraphicsContext::SetFont(const wxFont& font, const wxColour& colour)
|
||||
{
|
||||
if ( font.IsOk() )
|
||||
SetFont( CreateFont( font, colour ) );
|
||||
{
|
||||
// Change current font only if new graphics font is successfully created.
|
||||
wxGraphicsFont grFont = CreateFont(font, colour);
|
||||
if ( !grFont.IsSameAs(wxNullGraphicsFont) )
|
||||
{
|
||||
SetFont(grFont);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFont( wxNullGraphicsFont );
|
||||
}
|
||||
}
|
||||
|
||||
void wxGraphicsContext::DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle )
|
||||
|
||||
Reference in New Issue
Block a user