|
|
|
@ -1436,6 +1436,13 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
|
|
|
|
var lineHeight = _paragraphProperties.LineHeight; |
|
|
|
|
|
|
|
var lastRunIndex = _textRuns.Count - 1; |
|
|
|
|
|
|
|
if (_textRuns[lastRunIndex] is TextEndOfLine && lastRunIndex > 0) |
|
|
|
{ |
|
|
|
lastRunIndex--; |
|
|
|
} |
|
|
|
|
|
|
|
for (var index = 0; index < _textRuns.Count; index++) |
|
|
|
{ |
|
|
|
switch (_textRuns[index]) |
|
|
|
@ -1470,7 +1477,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (index == _textRuns.Count - 1) |
|
|
|
if (index == lastRunIndex) |
|
|
|
{ |
|
|
|
width = widthIncludingWhitespace + textRun.GlyphRun.Metrics.Width; |
|
|
|
trailingWhitespaceLength = textRun.GlyphRun.Metrics.TrailingWhitespaceLength; |
|
|
|
@ -1490,7 +1497,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
{ |
|
|
|
case FlowDirection.LeftToRight: |
|
|
|
{ |
|
|
|
if (index == _textRuns.Count - 1) |
|
|
|
if (index == lastRunIndex) |
|
|
|
{ |
|
|
|
width = widthIncludingWhitespace; |
|
|
|
trailingWhitespaceLength = 0; |
|
|
|
@ -1502,7 +1509,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
|
|
|
|
case FlowDirection.RightToLeft: |
|
|
|
{ |
|
|
|
if (index == _textRuns.Count - 1) |
|
|
|
if (index == lastRunIndex) |
|
|
|
{ |
|
|
|
width = widthIncludingWhitespace; |
|
|
|
trailingWhitespaceLength = 0; |
|
|
|
|