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:
@@ -10,6 +10,10 @@
|
||||
|
||||
wxGCDC is a device context that draws on a wxGraphicsContext.
|
||||
|
||||
@remarks
|
||||
If Direct2D is a renderer of underlying graphics context, only wxFont objects
|
||||
representing TrueType fonts can be used in the font-related functions.
|
||||
|
||||
@library{wxcore}
|
||||
@category{dc}
|
||||
|
||||
|
@@ -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