diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index 926e6c226b..23f9a46549 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -278,9 +278,6 @@ public: // Partial equality test taking flags into account bool EqPartial(const wxTextAttr& attr, int flags) const; - // Create font from font attributes. - wxFont CreateFont() const; - // Get attributes from font. bool GetFontAttributes(const wxFont& font, int flags = wxTEXT_ATTR_FONT); @@ -337,7 +334,7 @@ public: const wxString& GetFontFaceName() const { return m_fontFaceName; } wxFontEncoding GetFontEncoding() const { return m_fontEncoding; } - wxFont GetFont() const { return CreateFont(); } + wxFont GetFont() const; const wxString& GetCharacterStyleName() const { return m_characterStyleName; } const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } diff --git a/src/common/textcmn.cpp b/src/common/textcmn.cpp index 1e0a0a0f56..c69ba3aea1 100644 --- a/src/common/textcmn.cpp +++ b/src/common/textcmn.cpp @@ -297,8 +297,11 @@ bool wxTextAttr::EqPartial(const wxTextAttr& attr, int flags) const } // Create font from font attributes. -wxFont wxTextAttr::CreateFont() const +wxFont wxTextAttr::GetFont() const { + if ( !HasFont() ) + return wxNullFont; + int fontSize = 10; if (HasFontSize()) fontSize = GetFontSize();