Handle unsuccessful creation of graphics font in Direct2D
Apparently, DirectWrite fonts can be created only from TrueType fonts and therefore only such fonts can be used with Direct2D-based wxGraphicsContext. When unsuported GDI font is passed to CreateFont() then no graphics font is created and this unsuccessful attempt is signalled by returning wxNullGraphicsFont. This null object can be used in e.g. wxGC::SetFont() to check if font was actually created. See #17790.
This commit is contained in:
@@ -847,6 +847,9 @@ public:
|
||||
|
||||
/**
|
||||
Creates a native graphics font from a wxFont and a text colour.
|
||||
|
||||
@remarks
|
||||
For Direct2D graphics fonts can be created from TrueType fonts only.
|
||||
*/
|
||||
virtual wxGraphicsFont CreateFont(const wxFont& font,
|
||||
const wxColour& col = *wxBLACK) const;
|
||||
@@ -857,8 +860,11 @@ public:
|
||||
The use of overload taking wxFont is preferred, see
|
||||
wxGraphicsRenderer::CreateFont() for more details.
|
||||
|
||||
@remarks
|
||||
For Direct2D graphics fonts can be created from TrueType fonts only.
|
||||
|
||||
@since 2.9.3
|
||||
*/
|
||||
*/
|
||||
virtual wxGraphicsFont CreateFont(double sizeInPixels,
|
||||
const wxString& facename,
|
||||
int flags = wxFONTFLAG_DEFAULT,
|
||||
@@ -866,6 +872,9 @@ public:
|
||||
|
||||
/**
|
||||
Sets the font for drawing text.
|
||||
|
||||
@remarks
|
||||
For Direct2D only TrueType fonts can be used.
|
||||
*/
|
||||
void SetFont(const wxFont& font, const wxColour& colour);
|
||||
|
||||
|
Reference in New Issue
Block a user