X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c79853685d09ba1d7eaef604395c40b731ed2f34..e5f741e5d467b1ce7105be96e9f3dcb553e8b89d:/src/gtk/font.cpp diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index a486103090..83010c18da 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -31,6 +31,7 @@ #include #include +#include #include // ---------------------------------------------------------------------------- @@ -70,7 +71,7 @@ private: wxString m_faceName; wxFontEncoding m_encoding; - friend wxFont; + friend class wxFont; }; // ============================================================================ @@ -166,6 +167,7 @@ wxFont::wxFont( const wxString& fontname, const wxFontData& fontdata ) wxStringTokenizer tn( fontname, wxT("-") ); + tn.GetNextToken(); // skip initial empty token tn.GetNextToken(); // foundry M_FONTDATA->m_faceName = tn.GetNextToken(); // family @@ -189,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 @@ -392,13 +397,22 @@ void wxFont::SetEncoding(wxFontEncoding encoding) static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; -static GdkFont *GtkGetDefaultGuiFont() +GdkFont *GtkGetDefaultGuiFont() { if (!g_systemDefaultGuiFont) { GtkWidget *widget = gtk_button_new(); GtkStyle *def = gtk_rc_get_style( widget ); - g_systemDefaultGuiFont = gdk_font_ref( def->font ); + if (def) + { + g_systemDefaultGuiFont = gdk_font_ref( def->font ); + } + else + { + def = gtk_widget_get_default_style(); + if (def) + g_systemDefaultGuiFont = gdk_font_ref( def->font ); + } gtk_widget_destroy( widget ); } return g_systemDefaultGuiFont; @@ -428,7 +442,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const { font = GtkGetDefaultGuiFont(); } - else + if (!font) { font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_family,