|
|
|
@ -233,16 +233,16 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
|
|
|
|
var textLine = TextFormatter.Current.FormatLine(textSource, 0, MaxWidth, _paragraphProperties); |
|
|
|
|
|
|
|
UpdateBounds(textLine, ref left, ref right, ref bottom); |
|
|
|
|
|
|
|
textLines.Add(textLine); |
|
|
|
|
|
|
|
if (!double.IsPositiveInfinity(MaxHeight) && bottom + textLine.LineMetrics.Size.Height > MaxHeight) |
|
|
|
{ |
|
|
|
currentPosition = _text.Length; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
UpdateBounds(textLine, ref left, ref right, ref bottom); |
|
|
|
|
|
|
|
textLines.Add(textLine); |
|
|
|
|
|
|
|
if (_paragraphProperties.TextTrimming != TextTrimming.None) |
|
|
|
{ |
|
|
|
currentPosition += remainingLength; |
|
|
|
@ -254,22 +254,15 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
|
|
|
|
currentPosition += textLine.Text.Length; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (lineBreaker.Current.Required && currentPosition == _text.Length) |
|
|
|
{ |
|
|
|
var emptyTextLine = CreateEmptyTextLine(currentPosition); |
|
|
|
|
|
|
|
if (!double.IsPositiveInfinity(MaxHeight) && bottom + emptyTextLine.LineMetrics.Size.Height > MaxHeight) |
|
|
|
{ |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
UpdateBounds(emptyTextLine, ref left, ref right, ref bottom); |
|
|
|
if (lineBreaker.Current.Required && currentPosition == _text.Length) |
|
|
|
{ |
|
|
|
var emptyTextLine = CreateEmptyTextLine(currentPosition); |
|
|
|
|
|
|
|
textLines.Add(emptyTextLine); |
|
|
|
UpdateBounds(emptyTextLine, ref left, ref right, ref bottom); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
textLines.Add(emptyTextLine); |
|
|
|
} |
|
|
|
|
|
|
|
Bounds = new Rect(left, 0, right, bottom); |
|
|
|
|