diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 02d61bff58..26a9ba0dcb 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -31,6 +31,7 @@ #include #include +#include #include // ---------------------------------------------------------------------------- @@ -190,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 diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 658c74ab4e..4a491823fa 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -15,9 +15,13 @@ #include "wx/settings.h" #include "wx/debug.h" +#include "wx/cmndata.h" + #include +#include #include + /* #define wxSYS_COLOUR_SCROLLBAR 0 #define wxSYS_COLOUR_BACKGROUND 1 @@ -228,7 +232,35 @@ wxFont wxSystemSettings::GetSystemFont( int index ) case wxSYS_DEFAULT_GUI_FONT: { if (!g_systemFont) - g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + { + GdkFont *gdk_font = (GdkFont*) NULL; + GtkWidget *widget = gtk_button_new(); +#if 0 + GtkStyle *def = gtk_rc_get_style( widget ); + if (def) + gdk_font = def->font; + else + { + def = gtk_widget_get_default_style(); + if (def) + gdk_font = def->font; + } +#endif + if (gdk_font) + { + GSList *font_list = ((GdkFontPrivate*)gdk_font)->names; + char *name = (char*)font_list->data; + wxString font_string( name ); + wxFontData font_data; + g_systemFont = new wxFont( font_string, font_data ); + } + else + { + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + } + + gtk_widget_destroy( widget ); + } return *g_systemFont; } } diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 02d61bff58..26a9ba0dcb 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -31,6 +31,7 @@ #include #include +#include #include // ---------------------------------------------------------------------------- @@ -190,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 diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 658c74ab4e..4a491823fa 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -15,9 +15,13 @@ #include "wx/settings.h" #include "wx/debug.h" +#include "wx/cmndata.h" + #include +#include #include + /* #define wxSYS_COLOUR_SCROLLBAR 0 #define wxSYS_COLOUR_BACKGROUND 1 @@ -228,7 +232,35 @@ wxFont wxSystemSettings::GetSystemFont( int index ) case wxSYS_DEFAULT_GUI_FONT: { if (!g_systemFont) - g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + { + GdkFont *gdk_font = (GdkFont*) NULL; + GtkWidget *widget = gtk_button_new(); +#if 0 + GtkStyle *def = gtk_rc_get_style( widget ); + if (def) + gdk_font = def->font; + else + { + def = gtk_widget_get_default_style(); + if (def) + gdk_font = def->font; + } +#endif + if (gdk_font) + { + GSList *font_list = ((GdkFontPrivate*)gdk_font)->names; + char *name = (char*)font_list->data; + wxString font_string( name ); + wxFontData font_data; + g_systemFont = new wxFont( font_string, font_data ); + } + else + { + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + } + + gtk_widget_destroy( widget ); + } return *g_systemFont; } }