X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02d9204cad026be374b49be9a85bdff29edbe487..5cb61fed97c78e0399ba18457e45b51f8eb15edf:/src/gtk1/font.cpp diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index a31e07b949..9e42fdf9e6 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -464,10 +464,7 @@ void wxFontRefData::SetPointSize(int pointSize) m_pointSize = pointSize; #ifdef __WXGTK20__ - // Get native info - PangoFontDescription *desc = m_nativeFontInfo.description; - - pango_font_description_set_size( desc, m_pointSize * PANGO_SCALE ); + m_nativeFontInfo.SetPointSize(pointSize); #else if ( HasNativeFont() ) { @@ -494,24 +491,7 @@ void wxFontRefData::SetStyle(int style) m_style = style; #ifdef __WXGTK20__ - // Get native info - PangoFontDescription *desc = m_nativeFontInfo.description; - - switch ( style ) - { - case wxFONTSTYLE_ITALIC: - pango_font_description_set_style( desc, PANGO_STYLE_ITALIC ); - break; - case wxFONTSTYLE_SLANT: - pango_font_description_set_style( desc, PANGO_STYLE_OBLIQUE ); - break; - default: - wxFAIL_MSG( _T("unknown font style") ); - // fall through - case wxFONTSTYLE_NORMAL: - pango_font_description_set_style( desc, PANGO_STYLE_NORMAL ); - break; - } + m_nativeFontInfo.SetStyle((wxFontStyle)style); #else if ( HasNativeFont() ) { @@ -544,25 +524,7 @@ void wxFontRefData::SetWeight(int weight) m_weight = weight; #ifdef __WXGTK20__ - PangoFontDescription *desc = m_nativeFontInfo.description; - switch ( weight ) - { - case wxFONTWEIGHT_BOLD: - pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD); - break; - - case wxFONTWEIGHT_LIGHT: - pango_font_description_set_weight(desc, PANGO_WEIGHT_LIGHT); - break; - - default: - wxFAIL_MSG( _T("unknown font weight") ); - // fall through - - case wxFONTWEIGHT_NORMAL: - // unspecified - pango_font_description_set_weight(desc, PANGO_WEIGHT_NORMAL); - } + m_nativeFontInfo.SetWeight((wxFontWeight)weight); #else //!__WXGTK20__ if ( HasNativeFont() ) { @@ -602,7 +564,9 @@ void wxFontRefData::SetFaceName(const wxString& facename) { m_faceName = facename; -#ifndef __WXGTK20__ +#ifdef __WXGTK20__ + m_nativeFontInfo.SetFaceName(facename); +#else if ( HasNativeFont() ) { m_nativeFontInfo.SetXFontComponent(wxXLFD_FAMILY, facename); @@ -747,8 +711,15 @@ int wxFont::GetFamily() const wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); #if wxUSE_PANGO - return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetFamily() - : M_FONTDATA->m_family; + 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 @@ -782,12 +753,7 @@ bool wxFont::GetUnderlined() const { wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") ); -#if wxUSE_PANGO - return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetUnderlined() - : M_FONTDATA->m_underlined; -#else return M_FONTDATA->m_underlined; -#endif } wxFontEncoding wxFont::GetEncoding() const