From 15fad0f76c47a0587f45eff8da72564503209bbb Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Thu, 9 Feb 2023 06:08:56 +0100 Subject: [PATCH] Properly set headleass GlyphTypeface.FontMetrics --- .../HeadlessPlatformStubs.cs | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/Avalonia.Headless/HeadlessPlatformStubs.cs b/src/Avalonia.Headless/HeadlessPlatformStubs.cs index 2a04e624cb..46e3515d11 100644 --- a/src/Avalonia.Headless/HeadlessPlatformStubs.cs +++ b/src/Avalonia.Headless/HeadlessPlatformStubs.cs @@ -69,27 +69,17 @@ namespace Avalonia.Headless { public FontMetrics Metrics => new FontMetrics { - + DesignEmHeight = 1, + Ascent = 8, + Descent = 4, + LineGap = 0, + UnderlinePosition = 2, + UnderlineThickness = 1, + StrikethroughPosition = 2, + StrikethroughThickness = 1, + IsFixedPitch = true }; - public short DesignEmHeight => 10; - - public int Ascent => 5; - - public int Descent => 5; - - public int LineGap => 2; - - public int UnderlinePosition => 5; - - public int UnderlineThickness => 5; - - public int StrikethroughPosition => 5; - - public int StrikethroughThickness => 2; - - public bool IsFixedPitch => true; - public int GlyphCount => 1337; public FontSimulations FontSimulations { get; } @@ -112,7 +102,7 @@ namespace Avalonia.Headless public int GetGlyphAdvance(ushort glyph) { - return 1; + return 12; } public int[] GetGlyphAdvances(ReadOnlySpan glyphs) @@ -136,7 +126,7 @@ namespace Avalonia.Headless metrics = new GlyphMetrics { Height = 10, - Width = 10 + Width = 8 }; return true;