Browse Source
[WIP]Fix overhang leading calculation for negative values (#13672)
* [macOS] Fix overhand leading calculation
* Adjust TextLineMetrics
* Update expected result
pull/13688/head
Benedikt Stebner
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
3 deletions
-
src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
-
BIN
tests/TestFiles/Skia/Controls/TextBlock/RestrictedHeight_VerticalAlign.expected.png
|
|
|
@ -1325,12 +1325,12 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//The width of overhanging pixels ath the bottom
|
|
|
|
//The width of overhanging pixels at the bottom
|
|
|
|
var overhangAfter = Math.Max(0, bounds.Bottom - height); |
|
|
|
//The width of overhanging pixels at the origin
|
|
|
|
var overhangLeading = bounds.Left; |
|
|
|
var overhangLeading = Math.Abs(Math.Min(bounds.Left, 0)); |
|
|
|
//The width of overhanging pixels at the end
|
|
|
|
var overhangTrailing = Math.Max(0, bounds.Width - widthIncludingWhitespace); |
|
|
|
var overhangTrailing = Math.Max(0, bounds.Right - widthIncludingWhitespace); |
|
|
|
var hasOverflowed = width > _paragraphWidth; |
|
|
|
|
|
|
|
if (!double.IsNaN(lineHeight) && !MathUtilities.IsZero(lineHeight)) |
|
|
|
|
Width:
|
Height:
|
Size: 528 B
Width:
|
Height:
|
Size: 529 B
|