X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0aa1258a1b2bf2323c65fc0264c51ebf1dd067a8..8f8e45c4d941c9b17a77ec71595e3d7a39058234:/src/gtk1/font.cpp?ds=sidebyside diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index f62f55b840..560d5f67c8 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -241,6 +241,11 @@ void wxFontRefData::InitFromNative() // init fields m_faceName = wxGTK_CONV_BACK( pango_font_description_get_family( desc ) ); + // Pango sometimes needs to have a size + int pango_size = pango_font_description_get_size( desc ); + if (pango_size == 0) + pango_font_description_set_size( desc, 12 * PANGO_SCALE); + m_pointSize = pango_font_description_get_size( desc ) / PANGO_SCALE; switch (pango_font_description_get_style( desc )) @@ -443,13 +448,22 @@ wxFontRefData::wxFontRefData(const wxString& fontname) } #ifndef __WXGTK20__ + void wxFontRefData::ReInit(const wxString& fontname) { + // calling InitFromNative() resets m_underlined flag as X11 fonts are never + // underlined, but we don't want to lose its old value here so save it ... + bool underlined = m_underlined; + m_nativeFontInfo.SetXFontName(fontname); InitFromNative(); + + // ... and restore it now + m_underlined = underlined; } -#endif + +#endif // !__WXGTK20__ void wxFontRefData::ClearGdkFonts() { @@ -790,7 +804,7 @@ bool wxFont::GetNoAntiAliasing() return M_FONTDATA->m_noAA; } -wxNativeFontInfo *wxFont::GetNativeFontInfo() const +const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") ); @@ -799,7 +813,7 @@ wxNativeFontInfo *wxFont::GetNativeFontInfo() const GetInternalFont(); #endif - return new wxNativeFontInfo(M_FONTDATA->m_nativeFontInfo); + return &(M_FONTDATA->m_nativeFontInfo); } bool wxFont::IsFixedWidth() const