From: David Elliott Date: Sat, 13 Oct 2007 08:47:38 +0000 (+0000) Subject: Implement creation of wxFont from wxNativeFontInfo. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/05725592b93f7c16b08c6b09bfa508883012482a Implement creation of wxFont from wxNativeFontInfo. Implement all of the getters to return the fields from the wxNativeFontInfo contained in the wxFontRefData. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/cocoa/font.mm b/src/cocoa/font.mm index 43312a6e9e..26a0226aba 100644 --- a/src/cocoa/font.mm +++ b/src/cocoa/font.mm @@ -39,6 +39,12 @@ public: { } + wxFontRefData(const wxNativeFontInfo& info) + : wxGDIRefData() + , m_fontId(0) + , m_info(info) + {} + wxFontRefData(int size, int family, int style, @@ -89,9 +95,12 @@ wxFontRefData::~wxFontRefData() #define M_FONTDATA ((wxFontRefData*)m_refData) -bool wxFont::Create(const wxNativeFontInfo&) +bool wxFont::Create(const wxNativeFontInfo& nativeFontInfo) { - return false; + UnRef(); + m_refData = new wxFontRefData(nativeFontInfo); + + return true; } void wxFont::SetEncoding(wxFontEncoding) @@ -105,7 +114,8 @@ wxFontEncoding wxFont::GetEncoding() const int wxFont::GetPointSize() const { - return 0; + wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); + return M_FONTDATA->m_info.pointSize; } bool wxFont::GetUnderlined() const @@ -118,17 +128,20 @@ bool wxFont::GetUnderlined() const int wxFont::GetStyle() const { - return 0; + wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); + return M_FONTDATA->m_info.style; } int wxFont::GetFamily() const { - return 0; + wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); + return M_FONTDATA->m_info.family; } int wxFont::GetWeight() const { - return 0; + wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); + return M_FONTDATA->m_info.weight; } const wxNativeFontInfo *wxFont::GetNativeFontInfo() const