Browse Source

If the enforced lineheight is less than the regular line height adjust the ascent so the text is properly centered (#14669)

pull/14470/head
Benedikt Stebner 3 years ago
committed by GitHub
parent
commit
8d446239cc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs

7
src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs

@ -1336,6 +1336,13 @@ namespace Avalonia.Media.TextFormatting
if (!double.IsNaN(lineHeight) && !MathUtilities.IsZero(lineHeight))
{
if (lineHeight < height)
{
var offset = Math.Max(0, height - lineHeight) / 2;
ascent += offset;
}
height = lineHeight;
}

Loading…
Cancel
Save