X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7826e2dd838d59c6a8061b4fdd9f7326a6e06de3..00e6c2bd41efbbdd158c9fb609450ebe001a27cc:/src/gtk/font.cpp?ds=sidebyside diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index c58aca2e81..c8a4c8da16 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -152,13 +152,29 @@ wxFontRefData::~wxFontRefData() bool wxNativeFontInfo::FromString(const wxString& s) { - xFontName = s; + wxStringTokenizer tokenizer(s, _T(";")); + + wxString token = tokenizer.GetNextToken(); + // + // Ignore the version for now + // + + xFontName = tokenizer.GetNextToken(); + if(!xFontName) + return FALSE; + return TRUE; } wxString wxNativeFontInfo::ToString() const { - return xFontName; + wxString s; + + s.Printf(_T("%d;%s"), + 0, // version + xFontName.c_str()); + + return s; } // ---------------------------------------------------------------------------- @@ -177,7 +193,7 @@ wxFont::wxFont(const wxNativeFontInfo& info) { Init(); - Create(info.ToString()); + Create(info.xFontName); } bool wxFont::Create(const wxNativeFontInfo& info) @@ -201,8 +217,6 @@ bool wxFont::Create( int pointSize, bool wxFont::Create(const wxString& fontname, wxFontEncoding enc) { - Init(); - if( !fontname ) { *this = wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT); @@ -479,6 +493,12 @@ GdkFont *GtkGetDefaultGuiFont() } gtk_widget_destroy( widget ); } + else + { + // already have it, but ref it once more before returning + gdk_font_ref(g_systemDefaultGuiFont); + } + return g_systemDefaultGuiFont; }