Fix very poor performance on wxGTK when loading a lot of paragraphs with fonts

due to pango calls in font accessors called from FindOrCreateFont.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@67247 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2011-03-19 12:27:23 +00:00
parent b6cc6ae2c6
commit f1b06f8540

View File

@@ -1190,8 +1190,14 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
attr.SetFlags(fontFlags);
// FindOrCreateFont is an expensive operation on GTK+ (because pango functions are called)
// so only use it on other platforms
if (attr.HasFlag(wxTEXT_ATTR_FONT))
#ifdef __WXGTK__
attr.SetFont(wxFont(fontSize, fontFamily, fontStyle, fontWeight, fontUnderlined, fontFacename));
#else
attr.SetFont(* wxTheFontList->FindOrCreateFont(fontSize, fontFamily, fontStyle, fontWeight, fontUnderlined, fontFacename));
#endif
// Restore correct font flags
attr.SetFlags(fontFlags);