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:
parent
27e2ed8185
commit
c79853685d
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user