]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/font.cpp
Respect wxListItem::m_mask in general list control Set/GetItem() and allow
[wxWidgets.git] / src / x11 / font.cpp
index be44d65a0ddbdb73da7800aa7442350d4ab3b55d..125cb3545e3a591dd82cae7c33c4dbce3556140b 100644 (file)
@@ -79,10 +79,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
 
@@ -202,7 +202,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:
@@ -883,6 +883,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 +896,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 )
     {