]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextxml.cpp
avoid setting initial position if it was not specified, broken in r70734
[wxWidgets.git] / src / richtext / richtextxml.cpp
index fa3ee081c336a4e3fab94bd098cf88975728862e..2243f7c936e87024cb2d30927e77c10beea19bbc 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Julian Smart
 // Modified by:
 // Created:     2005-09-30
-// RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -1092,8 +1091,10 @@ wxString wxRichTextXMLHandler::AddAttributes(const wxRichTextAttr& attr, bool is
     if (attr.HasBackgroundColour() && attr.GetBackgroundColour().IsOk())
         AddAttribute(str, wxT("bgcolor"), attr.GetBackgroundColour());
 
-    if (attr.HasFontSize())
-        AddAttribute(str, wxT("fontsize"), attr.GetFontSize());
+    if (attr.HasFontPointSize())
+        AddAttribute(str, wxT("fontpointsize"), attr.GetFontSize());
+    else if (attr.HasFontPixelSize())
+        AddAttribute(str, wxT("fontpixelsize"), attr.GetFontSize());
 
     if (attr.HasFontFamily())
         AddAttribute(str, wxT("fontfamily"), attr.GetFontFamily());
@@ -1395,8 +1396,10 @@ bool wxRichTextXMLHandler::AddAttributes(wxXmlNode* node, wxRichTextAttr& attr,
     if (attr.HasBackgroundColour() && attr.GetBackgroundColour().IsOk())
         node->AddAttribute(wxT("bgcolor"), MakeString(attr.GetBackgroundColour()));
 
-    if (attr.HasFontSize())
-        node->AddAttribute(wxT("fontsize"), MakeString(attr.GetFontSize()));
+    if (attr.HasFontPointSize())
+        node->AddAttribute(wxT("fontpointsize"), MakeString(attr.GetFontSize()));
+    else if (attr.HasFontPixelSize())
+        node->AddAttribute(wxT("fontpixelsize"), MakeString(attr.GetFontSize()));
     if (attr.HasFontFamily())
         node->AddAttribute(wxT("fontfamily"), MakeString(attr.GetFontFamily()));
     if (attr.HasFontItalic())
@@ -1683,10 +1686,15 @@ bool wxRichTextXMLHandler::ImportStyle(wxRichTextAttr& attr, wxXmlNode* node, bo
             if (!value.empty())
                 attr.SetFontStyle((wxFontStyle)wxAtoi(value));
         }
-        else if (name == wxT("fontsize"))
+        else if (name == wxT("fontsize") || name == wxT("fontpointsize"))
         {
             if (!value.empty())
-                attr.SetFontSize(wxAtoi(value));
+                attr.SetFontPointSize(wxAtoi(value));
+        }
+        else if (name == wxT("fontpixelsize"))
+        {
+            if (!value.empty())
+                attr.SetFontPixelSize(wxAtoi(value));
         }
         else if (name == wxT("fontweight"))
         {