diff --git a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs index 4428dff0f1..fb6777c659 100644 --- a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs +++ b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs @@ -1,4 +1,4 @@ -// ReSharper disable ForCanBeConvertedToForeach +// ReSharper disable ForCanBeConvertedToForeach using System; using System.Buffers; using System.Collections.Generic; @@ -662,7 +662,7 @@ namespace Avalonia.Media.TextFormatting clusterLength = shapedTextCharacters.GlyphRun.Metrics.FirstCluster + currentRun.Length - currentInfo.GlyphCluster; } - if (currentWidth + clusterWidth > paragraphWidth) + if (MathUtilities.GreaterThan(currentWidth + clusterWidth, paragraphWidth)) { if (runLength == 0 && measuredLength == 0) { diff --git a/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs b/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs index 417dfc77fa..12ae974c26 100644 --- a/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs +++ b/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using Avalonia.Media.TextFormatting.Unicode; @@ -1423,7 +1423,7 @@ namespace Avalonia.Media.TextFormatting var overhangLeading = inkBounds.Left; //The width of overhanging pixels at the end of the natural bounds. Positive value means we are inside. var overhangTrailing = widthIncludingWhitespace - inkBounds.Right; - var hasOverflowed = width > _paragraphWidth; + var hasOverflowed = MathUtilities.GreaterThan(width, _paragraphWidth); var start = GetParagraphOffsetX(width, widthIncludingWhitespace);