From 8cc53ff56bca81205fcaeee615bea956d7fd88f4 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 25 Sep 2009 11:14:24 +0000 Subject: [PATCH] Applied #11238: Wrong text positioning if fonts with different Ascent/Descent ratio are on the same line git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@62120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextbuffer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 7f30af716e..0a12324254 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -3887,6 +3887,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style) int lineHeight = 0; int maxWidth = 0; int maxDescent = 0; + int maxAscent = 0; int lineCount = 0; wxRichTextObjectList::compatibility_iterator node; @@ -4017,8 +4018,9 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style) #endif currentWidth = actualSize.x; - lineHeight = wxMax(lineHeight, actualSize.y); maxDescent = wxMax(childDescent, maxDescent); + maxAscent = wxMax(actualSize.y-childDescent, maxAscent); + lineHeight = maxDescent + maxAscent; // Add a new line wxRichTextLine* line = AllocateLine(lineCount); @@ -4034,6 +4036,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style) currentPosition.y += lineSpacing; currentWidth = 0; maxDescent = 0; + maxAscent = 0; maxWidth = wxMax(maxWidth, currentWidth); lineCount ++; @@ -4057,8 +4060,9 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style) { // We still fit, so don't add a line, and keep going currentWidth += childSize.x; - lineHeight = wxMax(lineHeight, childSize.y); maxDescent = wxMax(childDescent, maxDescent); + maxAscent = wxMax(childSize.y-childDescent, maxAscent); + lineHeight = maxDescent + maxAscent; maxWidth = wxMax(maxWidth, currentWidth); lastEndPos = child->GetRange().GetEnd();