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/trunk@62119 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3355,8 +3355,8 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
|||||||
wxPoint currentPosition(0, spaceBeforePara); // We will calculate lines relative to paragraph
|
wxPoint currentPosition(0, spaceBeforePara); // We will calculate lines relative to paragraph
|
||||||
int lineHeight = 0;
|
int lineHeight = 0;
|
||||||
int maxWidth = 0;
|
int maxWidth = 0;
|
||||||
|
int maxAscent = 0;
|
||||||
int maxDescent = 0;
|
int maxDescent = 0;
|
||||||
|
|
||||||
int lineCount = 0;
|
int lineCount = 0;
|
||||||
|
|
||||||
wxRichTextObjectList::compatibility_iterator node;
|
wxRichTextObjectList::compatibility_iterator node;
|
||||||
@@ -3484,8 +3484,9 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
currentWidth = actualSize.x;
|
currentWidth = actualSize.x;
|
||||||
lineHeight = wxMax(lineHeight, actualSize.y);
|
|
||||||
maxDescent = wxMax(childDescent, maxDescent);
|
maxDescent = wxMax(childDescent, maxDescent);
|
||||||
|
maxAscent = wxMax(actualSize.y-childDescent, maxAscent);
|
||||||
|
lineHeight = maxDescent + maxAscent;
|
||||||
|
|
||||||
// Add a new line
|
// Add a new line
|
||||||
wxRichTextLine* line = AllocateLine(lineCount);
|
wxRichTextLine* line = AllocateLine(lineCount);
|
||||||
@@ -3501,6 +3502,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
|||||||
currentPosition.y += lineSpacing;
|
currentPosition.y += lineSpacing;
|
||||||
currentWidth = 0;
|
currentWidth = 0;
|
||||||
maxDescent = 0;
|
maxDescent = 0;
|
||||||
|
maxAscent = 0;
|
||||||
maxWidth = wxMax(maxWidth, currentWidth);
|
maxWidth = wxMax(maxWidth, currentWidth);
|
||||||
|
|
||||||
lineCount ++;
|
lineCount ++;
|
||||||
@@ -3524,8 +3526,9 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
|||||||
{
|
{
|
||||||
// We still fit, so don't add a line, and keep going
|
// We still fit, so don't add a line, and keep going
|
||||||
currentWidth += childSize.x;
|
currentWidth += childSize.x;
|
||||||
lineHeight = wxMax(lineHeight, childSize.y);
|
|
||||||
maxDescent = wxMax(childDescent, maxDescent);
|
maxDescent = wxMax(childDescent, maxDescent);
|
||||||
|
maxAscent = wxMax(childSize.y-childDescent, maxAscent);
|
||||||
|
lineHeight = maxDescent + maxAscent;
|
||||||
|
|
||||||
maxWidth = wxMax(maxWidth, currentWidth);
|
maxWidth = wxMax(maxWidth, currentWidth);
|
||||||
lastEndPos = child->GetRange().GetEnd();
|
lastEndPos = child->GetRange().GetEnd();
|
||||||
|
Reference in New Issue
Block a user