diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index cdaa71a813..560d5f67c8 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -448,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() { diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index cdaa71a813..560d5f67c8 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -448,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() {