From 9bc9cd46fefe4ce0b800296c608e53e126e014a3 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Fri, 30 Apr 2021 15:18:55 +0200 Subject: [PATCH] Include the TextLine's Start offset to the TextLayout's size calculation. --- src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs b/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs index ef427b0cd9..a4c9392fa0 100644 --- a/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs +++ b/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs @@ -305,9 +305,11 @@ namespace Avalonia.Media.TextFormatting /// The current height. private static void UpdateBounds(TextLine textLine, ref double width, ref double height) { - if (width < textLine.Width) + var lineWidth = textLine.Width + textLine.Start * 2; + + if (width < lineWidth) { - width = textLine.Width; + width = lineWidth; } height += textLine.Height;