Correct deafult GUI font is now found when querying

wxSystemSetting. Hack.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2000-01-04 14:34:03 +00:00
parent 27e2ed8185
commit c79853685d
4 changed files with 38 additions and 20 deletions

View File

@ -26,10 +26,12 @@
#include "wx/log.h"
#include "wx/gdicmn.h"
#include "wx/tokenzr.h"
#include "wx/settings.h"
#include <strings.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
// ----------------------------------------------------------------------------
// 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,

View File

@ -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;
}
}

View File

@ -26,10 +26,12 @@
#include "wx/log.h"
#include "wx/gdicmn.h"
#include "wx/tokenzr.h"
#include "wx/settings.h"
#include <strings.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
// ----------------------------------------------------------------------------
// 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,

View File

@ -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;
}
}