X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a2beab222f9b0b9467da61b78e125edf955dd6ed..a82e28dd0336e2829496fa1ea0f6a327cf0099c6:/src/richtext/richtextxml.cpp diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 67d60fd0cf..d967ae5d02 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -174,7 +174,7 @@ bool wxRichTextXMLHandler::ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node) else if (childName == wxT("image")) { wxBitmapType imageType = wxBITMAP_TYPE_PNG; - wxString value = node->GetAttribute(wxT("imagetype"), wxEmptyString); + wxString value = child->GetAttribute(wxT("imagetype"), wxEmptyString); if (!value.empty()) { int type = wxAtoi(value); @@ -971,8 +971,8 @@ wxString wxRichTextXMLHandler::CreateStyle(const wxTextAttr& attr, bool isPara) if (attr.HasFontSize()) str << wxT(" fontsize=\"") << attr.GetFontSize() << wxT("\""); - //if (attr.HasFontFamily()) - // str << wxT(" fontfamily=\"") << attr.GetFont().GetFamily() << wxT("\""); + if (attr.HasFontFamily()) + str << wxT(" fontfamily=\"") << attr.GetFont().GetFamily() << wxT("\""); if (attr.HasFontItalic()) str << wxT(" fontstyle=\"") << attr.GetFontStyle() << wxT("\""); @@ -1131,9 +1131,9 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPa { wxString fontFacename; int fontSize = 12; - // int fontFamily = wxDEFAULT; - int fontWeight = wxNORMAL; - int fontStyle = wxNORMAL; + wxFontFamily fontFamily = wxFONTFAMILY_DEFAULT; + wxFontWeight fontWeight = wxFONTWEIGHT_NORMAL; + wxFontStyle fontStyle = wxFONTSTYLE_NORMAL; bool fontUnderlined = false; // int fontFlags = 0; @@ -1146,16 +1146,18 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPa wxRichTextFixFaceName(fontFacename); } - wxString value; - //value = node->GetAttribute(wxT("fontfamily"), wxEmptyString); - //if (!value.empty()) - // fontFamily = wxAtoi(value); + value = node->GetAttribute(wxT("fontfamily"), wxEmptyString); + if (!value.empty()) + { + fontFamily = (wxFontFamily)wxAtoi(value); + attr.SetFontFamily(fontFamily); + } value = node->GetAttribute(wxT("fontstyle"), wxEmptyString); if (!value.empty()) { - fontStyle = wxAtoi(value); + fontStyle = (wxFontStyle)wxAtoi(value); attr.SetFontStyle(fontStyle); } @@ -1169,7 +1171,7 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPa value = node->GetAttribute(wxT("fontweight"), wxEmptyString); if (!value.empty()) { - fontWeight = wxAtoi(value); + fontWeight = (wxFontWeight)wxAtoi(value); attr.SetFontWeight(fontWeight); }