From: Julian Smart Date: Mon, 11 Mar 2013 18:03:54 +0000 (+0000) Subject: Search for font instead of creating it each time X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/77120d82a4d285973a4025e3c879a8bf35b45a76?ds=inline Search for font instead of creating it each time git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 2a6374708d..2a3325fbef 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -4678,10 +4678,14 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co int lineSpacing = 0; // Let's assume line spacing of 10 is normal, 15 is 1.5, 20 is 2, etc. - if (attr.HasLineSpacing() && attr.GetLineSpacing() > 0 && attr.GetFont().IsOk()) + if (attr.HasLineSpacing() && attr.GetLineSpacing() > 0 && attr.HasFont()) { - wxCheckSetFont(dc, attr.GetFont()); - lineSpacing = (int) (double(dc.GetCharHeight()) * (double(attr.GetLineSpacing())/10.0 - 1.0)); + wxFont font(buffer->GetFontTable().FindFont(attr)); + if (font.IsOk()) + { + wxCheckSetFont(dc, font); + lineSpacing = (int) (double(dc.GetCharHeight()) * (double(attr.GetLineSpacing())/10.0 - 1.0)); + } } // Start position for each line relative to the paragraph