From a00946492d104c36ba148f1f17048089d6aa2423 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Fri, 24 Mar 2023 19:04:21 +0100 Subject: [PATCH] Fix failing test --- .../Media/TextFormatting/TextLineImpl.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs b/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs index f522ffb5c3..f5812f71ff 100644 --- a/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs +++ b/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs @@ -697,6 +697,16 @@ namespace Avalonia.Media.TextFormatting i = lastRunIndex; + //Possible overlap at runs of different direction + if (directionalWidth == 0) + { + //In case a run only contains a linebreak we don't want to skip it. + if (currentRun is ShapedTextRun shaped && currentRun.Length - shaped.GlyphRun.Metrics.NewLineLength > 0) + { + continue; + } + } + int coveredLength; TextBounds? textBounds; @@ -826,6 +836,16 @@ namespace Avalonia.Media.TextFormatting i = firstRunIndex; + //Possible overlap at runs of different direction + if (directionalWidth == 0) + { + //In case a run only contains a linebreak we don't want to skip it. + if (currentRun is ShapedTextRun shaped && currentRun.Length - shaped.GlyphRun.Metrics.NewLineLength > 0) + { + continue; + } + } + TextBounds? textBounds = null; int coveredLength;