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:
@@ -26,10 +26,12 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxFontRefData
|
// wxFontRefData
|
||||||
@@ -388,6 +390,20 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
|
|||||||
// get internal representation of font
|
// 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
|
GdkFont *wxFont::GetInternalFont( float scale ) const
|
||||||
{
|
{
|
||||||
if (!Ok())
|
if (!Ok())
|
||||||
@@ -408,18 +424,11 @@ GdkFont *wxFont::GetInternalFont( float scale ) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
if (*this == wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT))
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
|
font = GtkGetDefaultGuiFont();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // 0
|
|
||||||
{
|
{
|
||||||
font = wxLoadQueryNearestFont( point_scale,
|
font = wxLoadQueryNearestFont( point_scale,
|
||||||
M_FONTDATA->m_family,
|
M_FONTDATA->m_family,
|
||||||
|
@@ -186,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index )
|
|||||||
case wxSYS_DEFAULT_GUI_FONT:
|
case wxSYS_DEFAULT_GUI_FONT:
|
||||||
{
|
{
|
||||||
if (!g_systemFont)
|
if (!g_systemFont)
|
||||||
g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL );
|
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
||||||
return *g_systemFont;
|
return *g_systemFont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,10 +26,12 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxFontRefData
|
// wxFontRefData
|
||||||
@@ -388,6 +390,20 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
|
|||||||
// get internal representation of font
|
// 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
|
GdkFont *wxFont::GetInternalFont( float scale ) const
|
||||||
{
|
{
|
||||||
if (!Ok())
|
if (!Ok())
|
||||||
@@ -408,18 +424,11 @@ GdkFont *wxFont::GetInternalFont( float scale ) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
if (*this == wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT))
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
|
font = GtkGetDefaultGuiFont();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // 0
|
|
||||||
{
|
{
|
||||||
font = wxLoadQueryNearestFont( point_scale,
|
font = wxLoadQueryNearestFont( point_scale,
|
||||||
M_FONTDATA->m_family,
|
M_FONTDATA->m_family,
|
||||||
|
@@ -186,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index )
|
|||||||
case wxSYS_DEFAULT_GUI_FONT:
|
case wxSYS_DEFAULT_GUI_FONT:
|
||||||
{
|
{
|
||||||
if (!g_systemFont)
|
if (!g_systemFont)
|
||||||
g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL );
|
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
||||||
return *g_systemFont;
|
return *g_systemFont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user