+wxFont wxXmlResourceHandler::GetFont(const wxString& param)
+{
+ wxXmlNode *font_node = GetParamNode(param);
+ if (font_node == NULL)
+ {
+ wxLogError("Cannot find font node '%s'.", param.mb_str());
+ return wxNullFont;
+ }
+
+ wxXmlNode *oldnode = m_Node;
+ m_Node = font_node;
+
+ long size = GetLong(_("size"), 12);
+
+ wxString style = GetParamValue(_("style"));
+ wxString weight = GetParamValue(_("weight"));
+ int istyle = wxNORMAL, iweight = wxNORMAL;
+ if (style == _("italic")) istyle = wxITALIC;
+ else if (style == _("slant")) istyle = wxSLANT;
+ if (weight == _("bold")) iweight = wxBOLD;
+ else if (weight == _("light")) iweight = wxLIGHT;
+
+ bool underlined = GetBool(_("underlined"), FALSE);
+
+ wxString encoding = GetParamValue(_("encoding"));
+ // FIXME - handle encoding
+
+ wxString faces = GetParamValue(_("face"));
+ wxString facename = wxEmptyString;
+ wxFontEnumerator enu;
+ enu.EnumerateFacenames();
+ wxStringTokenizer tk(faces, ",");
+ while (tk.HasMoreTokens())
+ {
+ int index = enu.GetFacenames()->Index(tk.GetNextToken(), FALSE);
+ if (index != wxNOT_FOUND)
+ {
+ facename = (*enu.GetFacenames())[index];
+ break;
+ }
+ }
+
+ m_Node = oldnode;
+
+ wxFont font(size, wxDEFAULT, istyle, iweight, underlined,
+ facename, wxFONTENCODING_DEFAULT);
+ return font;
+}
+
+