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
This commit is contained in:
Julian Smart
2013-03-11 18:03:54 +00:00
parent 2739227180
commit 77120d82a4

View File

@@ -4678,10 +4678,14 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
int lineSpacing = 0; int lineSpacing = 0;
// Let's assume line spacing of 10 is normal, 15 is 1.5, 20 is 2, etc. // 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()); wxFont font(buffer->GetFontTable().FindFont(attr));
lineSpacing = (int) (double(dc.GetCharHeight()) * (double(attr.GetLineSpacing())/10.0 - 1.0)); 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 // Start position for each line relative to the paragraph