X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd05139a8023fd3e30476409fafbe04221c6d627..6a8cbe1b9202ee5eb7a8bfa9b2ce66afeadfad6a:/src/gtk1/font.cpp diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index f2334339a0..097519952e 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -54,7 +54,7 @@ WX_DECLARE_HASH_MAP(int, GdkFont *, wxIntegerHash, wxIntegerEqual, // wxFontRefData // ---------------------------------------------------------------------------- -class wxFontRefData : public wxObjectRefData +class wxFontRefData : public wxGDIRefData { public: // from broken down font parameters, also default ctor @@ -153,6 +153,8 @@ private: friend class wxFont; }; +#define M_FONTDATA ((wxFontRefData*)m_refData) + // ---------------------------------------------------------------------------- // wxFontRefData // ---------------------------------------------------------------------------- @@ -213,8 +215,8 @@ void wxFontRefData::InitFromNative() } } - switch ( wxToupper(*m_nativeFontInfo. - GetXFontComponent(wxXLFD_SLANT).c_str()) ) + switch ( wxToupper(m_nativeFontInfo. + GetXFontComponent(wxXLFD_SLANT)[0u]).GetValue() ) { case _T('I'): // italique m_style = wxFONTSTYLE_ITALIC; @@ -289,7 +291,7 @@ void wxFontRefData::InitFromNative() } wxFontRefData::wxFontRefData( const wxFontRefData& data ) - : wxObjectRefData() + : wxGDIRefData() { m_pointSize = data.m_pointSize; m_family = data.m_family; @@ -534,6 +536,16 @@ wxFont::~wxFont() { } +wxGDIRefData *wxFont::CreateGDIRefData() const +{ + return new wxFontRefData; +} + +wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const +{ + return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data)); +} + // ---------------------------------------------------------------------------- // accessors // ---------------------------------------------------------------------------- @@ -542,67 +554,35 @@ int wxFont::GetPointSize() const { wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); -#if wxUSE_PANGO - return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetPointSize() - : M_FONTDATA->m_pointSize; -#else return M_FONTDATA->m_pointSize; -#endif } wxString wxFont::GetFaceName() const { wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") ); -#if wxUSE_PANGO - return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetFaceName() - : M_FONTDATA->m_faceName; -#else return M_FONTDATA->m_faceName; -#endif } int wxFont::GetFamily() const { wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); -#if wxUSE_PANGO - int ret = M_FONTDATA->m_family; - if (M_FONTDATA->HasNativeFont()) - // wxNativeFontInfo::GetFamily is expensive, must not call more than once - ret = M_FONTDATA->m_nativeFontInfo.GetFamily(); - - if (ret == wxFONTFAMILY_DEFAULT) - ret = M_FONTDATA->m_family; - - return ret; -#else return M_FONTDATA->m_family; -#endif } int wxFont::GetStyle() const { wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); -#if wxUSE_PANGO - return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetStyle() - : M_FONTDATA->m_style; -#else return M_FONTDATA->m_style; -#endif } int wxFont::GetWeight() const { wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); -#if wxUSE_PANGO - return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetWeight() - : M_FONTDATA->m_weight; -#else return M_FONTDATA->m_weight; -#endif } bool wxFont::GetUnderlined() const