]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/font.cpp
fixed FindOrCreatePen/Brush() for the case when the object couldn't be created succes...
[wxWidgets.git] / src / gtk1 / font.cpp
index c58aca2e818c1a1ba41929c0ed121fe9fdc9b85d..22c761e6fced1f71798a3145eb9abee1c00b7af8 100644 (file)
@@ -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("%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);