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:
@@ -1190,8 +1190,14 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
|
|||||||
|
|
||||||
attr.SetFlags(fontFlags);
|
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))
|
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));
|
attr.SetFont(* wxTheFontList->FindOrCreateFont(fontSize, fontFamily, fontStyle, fontWeight, fontUnderlined, fontFacename));
|
||||||
|
#endif
|
||||||
|
|
||||||
// Restore correct font flags
|
// Restore correct font flags
|
||||||
attr.SetFlags(fontFlags);
|
attr.SetFlags(fontFlags);
|
||||||
|
Reference in New Issue
Block a user