X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7826e2dd838d59c6a8061b4fdd9f7326a6e06de3..28978e0c5af8ec9a6ee0ab82456567cbfca221f7:/src/gtk/font.cpp diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index c58aca2e81..d1239aba25 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -146,21 +146,6 @@ wxFontRefData::~wxFontRefData() } } -// ---------------------------------------------------------------------------- -// wxNativeFontInfo -// ---------------------------------------------------------------------------- - -bool wxNativeFontInfo::FromString(const wxString& s) -{ - xFontName = s; - return TRUE; -} - -wxString wxNativeFontInfo::ToString() const -{ - return xFontName; -} - // ---------------------------------------------------------------------------- // wxFont // ---------------------------------------------------------------------------- @@ -169,15 +154,13 @@ IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) void wxFont::Init() { - if (wxTheFontList) - wxTheFontList->Append( this ); } wxFont::wxFont(const wxNativeFontInfo& info) { Init(); - Create(info.ToString()); + Create(info.xFontName); } bool wxFont::Create(const wxNativeFontInfo& info) @@ -201,11 +184,9 @@ bool wxFont::Create( int pointSize, bool wxFont::Create(const wxString& fontname, wxFontEncoding enc) { - Init(); - if( !fontname ) { - *this = wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT); + *this = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT); return TRUE; } @@ -320,8 +301,6 @@ void wxFont::Unshare() wxFont::~wxFont() { - if (wxTheFontList) - wxTheFontList->DeleteObject( this ); } // ---------------------------------------------------------------------------- @@ -479,6 +458,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; } @@ -502,7 +487,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const } else { - if (*this == wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT)) + if (*this == wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT)) { font = GtkGetDefaultGuiFont(); }