Fixed [wxRichTextCtrl] Right Alignment sets text in the RTC too close to the border (#10277)
Also [wxRichTextCtrl] Wrong text positioning if different font sizes in the same paragraph (#10279) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57973 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3453,6 +3453,10 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
|||||||
wxSize actualSize;
|
wxSize actualSize;
|
||||||
wxRichTextRange actualRange(lastCompletedEndPos+1, wrapPosition);
|
wxRichTextRange actualRange(lastCompletedEndPos+1, wrapPosition);
|
||||||
|
|
||||||
|
/// Use previous descent, not the wrapping descent we just found, since this may be too big
|
||||||
|
/// for the fragment we're about to add.
|
||||||
|
childDescent = maxDescent;
|
||||||
|
|
||||||
#if wxRICHTEXT_USE_PARTIAL_TEXT_EXTENTS
|
#if wxRICHTEXT_USE_PARTIAL_TEXT_EXTENTS
|
||||||
// Get height only, then the width using the partial extents
|
// Get height only, then the width using the partial extents
|
||||||
GetRangeSize(actualRange, actualSize, childDescent, dc, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_HEIGHT_ONLY);
|
GetRangeSize(actualRange, actualSize, childDescent, dc, wxRICHTEXT_UNFORMATTED|wxRICHTEXT_HEIGHT_ONLY);
|
||||||
@@ -3620,12 +3624,16 @@ void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttr& attr, const wxRe
|
|||||||
{
|
{
|
||||||
int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
|
int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
|
||||||
pos.x = (rect.GetWidth() - (pos.x - rect.x) - rightIndent - size.x)/2 + pos.x;
|
pos.x = (rect.GetWidth() - (pos.x - rect.x) - rightIndent - size.x)/2 + pos.x;
|
||||||
|
// Lines are relative to the paragraph position
|
||||||
|
pos.x -= GetPosition().x;
|
||||||
line->SetPosition(pos);
|
line->SetPosition(pos);
|
||||||
}
|
}
|
||||||
else if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
|
else if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
|
||||||
{
|
{
|
||||||
int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
|
int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
|
||||||
pos.x = rect.x + rect.GetWidth() - size.x - rightIndent;
|
pos.x = rect.x + rect.GetWidth() - size.x - rightIndent;
|
||||||
|
// Lines are relative to the paragraph position
|
||||||
|
pos.x -= GetPosition().x;
|
||||||
line->SetPosition(pos);
|
line->SetPosition(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user