]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/font.cpp
1. removed 'B' flag from treebase.cpp and regenerated the makefiles
[wxWidgets.git] / src / gtk / font.cpp
index a4861030902b111ea2e0bc23f3203ed95b2b5831..83010c18da9d477b7255e7ff55a91e9294f9c9f9 100644 (file)
@@ -31,6 +31,7 @@
 #include <strings.h>
 
 #include <gdk/gdk.h>
+#include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
 
 // ----------------------------------------------------------------------------
@@ -70,7 +71,7 @@ private:
     wxString        m_faceName;
     wxFontEncoding  m_encoding;
 
-    friend wxFont;
+    friend class wxFont;
 };
 
 // ============================================================================
@@ -166,6 +167,7 @@ wxFont::wxFont( const wxString& fontname, const wxFontData& fontdata )
 
     wxStringTokenizer tn( fontname, wxT("-") );
 
+    tn.GetNextToken();                           // skip initial empty token
     tn.GetNextToken();                           // foundry
 
     M_FONTDATA->m_faceName = tn.GetNextToken();  // family
@@ -189,8 +191,11 @@ wxFont::wxFont( const wxString& fontname, const wxFontData& fontdata )
     tn.GetNextToken();                           // pixel size
 
     tmp = tn.GetNextToken();                     // pointsize
-    long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
-    M_FONTDATA->m_pointSize = (int)(num / 10);
+    if (tmp != wxT("*"))
+    {
+        long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
+        M_FONTDATA->m_pointSize = (int)(num / 10);
+    }
 
     tn.GetNextToken();                           // x-res
     tn.GetNextToken();                           // y-res
@@ -392,13 +397,22 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
 
 static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL;
 
-static GdkFont *GtkGetDefaultGuiFont()
+GdkFont *GtkGetDefaultGuiFont()
 {
     if (!g_systemDefaultGuiFont)
     {
         GtkWidget *widget = gtk_button_new();
         GtkStyle *def = gtk_rc_get_style( widget );
-        g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        if (def)
+        {
+            g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        }
+        else
+        {
+            def = gtk_widget_get_default_style();
+            if (def)
+                g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        }
         gtk_widget_destroy( widget );
     }
     return g_systemDefaultGuiFont;
@@ -428,7 +442,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const
         {
             font = GtkGetDefaultGuiFont();
         }
-        else
+        if (!font)
         {
             font = wxLoadQueryNearestFont( point_scale,
                                            M_FONTDATA->m_family,