diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index a957f4f68a..a486103090 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -26,10 +26,12 @@ #include "wx/log.h" #include "wx/gdicmn.h" #include "wx/tokenzr.h" +#include "wx/settings.h" #include #include +#include // ---------------------------------------------------------------------------- // wxFontRefData @@ -388,6 +390,20 @@ void wxFont::SetEncoding(wxFontEncoding encoding) // get internal representation of font // ---------------------------------------------------------------------------- +static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; + +static GdkFont *GtkGetDefaultGuiFont() +{ + if (!g_systemDefaultGuiFont) + { + GtkWidget *widget = gtk_button_new(); + GtkStyle *def = gtk_rc_get_style( widget ); + g_systemDefaultGuiFont = gdk_font_ref( def->font ); + gtk_widget_destroy( widget ); + } + return g_systemDefaultGuiFont; +} + GdkFont *wxFont::GetInternalFont( float scale ) const { if (!Ok()) @@ -408,18 +424,11 @@ GdkFont *wxFont::GetInternalFont( float scale ) const } else { -#if 0 - if ((int_scale == 100) && - (M_FONTDATA->m_family == wxSWISS) && - (M_FONTDATA->m_style == wxNORMAL) && - (M_FONTDATA->m_pointSize == 12) && - (M_FONTDATA->m_weight == wxNORMAL) && - (M_FONTDATA->m_underlined == FALSE)) + if (*this == wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT)) { - font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" ); + font = GtkGetDefaultGuiFont(); } else -#endif // 0 { font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_family, diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 2fde66188c..db8fbc1bb6 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -186,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index ) case wxSYS_DEFAULT_GUI_FONT: { if (!g_systemFont) - g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL ); + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); return *g_systemFont; } } diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index a957f4f68a..a486103090 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -26,10 +26,12 @@ #include "wx/log.h" #include "wx/gdicmn.h" #include "wx/tokenzr.h" +#include "wx/settings.h" #include #include +#include // ---------------------------------------------------------------------------- // wxFontRefData @@ -388,6 +390,20 @@ void wxFont::SetEncoding(wxFontEncoding encoding) // get internal representation of font // ---------------------------------------------------------------------------- +static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; + +static GdkFont *GtkGetDefaultGuiFont() +{ + if (!g_systemDefaultGuiFont) + { + GtkWidget *widget = gtk_button_new(); + GtkStyle *def = gtk_rc_get_style( widget ); + g_systemDefaultGuiFont = gdk_font_ref( def->font ); + gtk_widget_destroy( widget ); + } + return g_systemDefaultGuiFont; +} + GdkFont *wxFont::GetInternalFont( float scale ) const { if (!Ok()) @@ -408,18 +424,11 @@ GdkFont *wxFont::GetInternalFont( float scale ) const } else { -#if 0 - if ((int_scale == 100) && - (M_FONTDATA->m_family == wxSWISS) && - (M_FONTDATA->m_style == wxNORMAL) && - (M_FONTDATA->m_pointSize == 12) && - (M_FONTDATA->m_weight == wxNORMAL) && - (M_FONTDATA->m_underlined == FALSE)) + if (*this == wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT)) { - font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" ); + font = GtkGetDefaultGuiFont(); } else -#endif // 0 { font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_family, diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 2fde66188c..db8fbc1bb6 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -186,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index ) case wxSYS_DEFAULT_GUI_FONT: { if (!g_systemFont) - g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL ); + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); return *g_systemFont; } }