Browse Source
Use epsilon-aware greater than in TextLine and TextFormatter (#20650)
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
release/latest
kerams
1 month ago
committed by
Julien Lebosquain
No known key found for this signature in database
GPG Key ID: 1833CAD10ACC46FD
2 changed files with
4 additions and
4 deletions
-
src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs
-
src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
|
|
@ -1,4 +1,4 @@ |
|
|
// ReSharper disable ForCanBeConvertedToForeach
|
|
|
// ReSharper disable ForCanBeConvertedToForeach
|
|
|
using System; |
|
|
using System; |
|
|
using System.Buffers; |
|
|
using System.Buffers; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
@ -658,7 +658,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
clusterLength = shapedTextCharacters.GlyphRun.Metrics.FirstCluster + currentRun.Length - currentInfo.GlyphCluster; |
|
|
clusterLength = shapedTextCharacters.GlyphRun.Metrics.FirstCluster + currentRun.Length - currentInfo.GlyphCluster; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (currentWidth + clusterWidth > paragraphWidth) |
|
|
if (MathUtilities.GreaterThan(currentWidth + clusterWidth, paragraphWidth)) |
|
|
{ |
|
|
{ |
|
|
if (runLength == 0 && measuredLength == 0) |
|
|
if (runLength == 0 && measuredLength == 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Diagnostics; |
|
|
using System.Diagnostics; |
|
|
using Avalonia.Media.TextFormatting.Unicode; |
|
|
using Avalonia.Media.TextFormatting.Unicode; |
|
|
@ -1423,7 +1423,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
var overhangLeading = inkBounds.Left; |
|
|
var overhangLeading = inkBounds.Left; |
|
|
//The width of overhanging pixels at the end of the natural bounds. Positive value means we are inside.
|
|
|
//The width of overhanging pixels at the end of the natural bounds. Positive value means we are inside.
|
|
|
var overhangTrailing = widthIncludingWhitespace - inkBounds.Right; |
|
|
var overhangTrailing = widthIncludingWhitespace - inkBounds.Right; |
|
|
var hasOverflowed = width > _paragraphWidth; |
|
|
var hasOverflowed = MathUtilities.GreaterThan(width, _paragraphWidth); |
|
|
|
|
|
|
|
|
var start = GetParagraphOffsetX(width, widthIncludingWhitespace); |
|
|
var start = GetParagraphOffsetX(width, widthIncludingWhitespace); |
|
|
|
|
|
|
|
|
|