X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..b09a59f521e4a365f1b073e26e53f17a5e03e1fa:/src/x11/font.cpp?ds=inline diff --git a/src/x11/font.cpp b/src/x11/font.cpp index 4eaee81f00..08742ac42e 100644 --- a/src/x11/font.cpp +++ b/src/x11/font.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "font.h" -#endif - #ifdef __VMS #pragma message disable nosimpint #include "wx/vms_x_fix.h" @@ -79,10 +75,10 @@ wxXFont::wxXFont() wxXFont::~wxXFont() { - // TODO: why does freeing the font produce a segv??? - // Note that XFreeFont wasn't called in wxWin 1.68 either. - // XFontStruct* fontStruct = (XFontStruct*) m_fontStruct; - // XFreeFont((Display*) m_display, fontStruct); + // Freeing the font used to produce a segv, but + // appears to be OK now (bug fix in X11?) + XFontStruct* fontStruct = (XFontStruct*) m_fontStruct; + XFreeFont((Display*) m_display, fontStruct); } #endif @@ -123,7 +119,7 @@ public: void SetEncoding(wxFontEncoding encoding); void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } - bool GetNoAntiAliasing() { return m_noAA; } + bool GetNoAntiAliasing() const { return m_noAA; } // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -202,7 +198,7 @@ void wxFontRefData::Init(int pointSize, case wxFONTFAMILY_TELETYPE: pango_font_description_set_family( m_nativeFontInfo.description, "monospace" ); break; - case wxFONTFAMILY_SWISS: + case wxFONTFAMILY_ROMAN: pango_font_description_set_family( m_nativeFontInfo.description, "serif" ); break; default: @@ -526,14 +522,8 @@ void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo& info) // wxFont // ---------------------------------------------------------------------------- -void wxFont::Init() -{ -} - wxFont::wxFont(const wxNativeFontInfo& info) { - Init(); - #if wxUSE_UNICODE Create( info.GetPointSize(), info.GetFamily(), @@ -745,7 +735,7 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->m_encoding; } -bool wxFont::GetNoAntiAliasing() +bool wxFont::GetNoAntiAliasing() const { wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") ); @@ -883,6 +873,11 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const node = node->GetNext(); } + wxString xFontName = M_FONTDATA->m_nativeFontInfo.GetXFontName(); + if (xFontName == "-*-*-*-*-*--*-*-*-*-*-*-*-*") + // wxFont constructor not called with native font info parameter => take M_FONTDATA values + xFontName.Clear(); + // not found, create a new one XFontStruct *font = (XFontStruct *) wxLoadQueryNearestFont(pointSize, @@ -891,7 +886,8 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const M_FONTDATA->m_weight, M_FONTDATA->m_underlined, wxT(""), - M_FONTDATA->m_encoding); + M_FONTDATA->m_encoding, + & xFontName); if ( !font ) {