]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/font.cpp
Bug fix in GetLabelFromText
[wxWidgets.git] / src / gtk1 / font.cpp
index a4861030902b111ea2e0bc23f3203ed95b2b5831..5e9d1ce629aec4527207a93e0d9f0d1444302985 100644 (file)
@@ -398,7 +398,16 @@ static GdkFont *GtkGetDefaultGuiFont()
     {
         GtkWidget *widget = gtk_button_new();
         GtkStyle *def = gtk_rc_get_style( widget );
     {
         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;
         gtk_widget_destroy( widget );
     }
     return g_systemDefaultGuiFont;
@@ -428,7 +437,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const
         {
             font = GtkGetDefaultGuiFont();
         }
         {
             font = GtkGetDefaultGuiFont();
         }
-        else
+        if (!font)
         {
             font = wxLoadQueryNearestFont( point_scale,
                                            M_FONTDATA->m_family,
         {
             font = wxLoadQueryNearestFont( point_scale,
                                            M_FONTDATA->m_family,