From f9eacdf060520b13462a9862a652a1d106690d97 Mon Sep 17 00:00:00 2001 From: Beldaa Date: Sat, 18 Apr 2026 16:38:11 +0200 Subject: [PATCH] Fix FontRun.UpdateOverhang using wrong offset for glyph pointer Used Start (code point index) instead of Glyphs.Start (glyph array offset) when passing the glyph pointer to GetGlyphWidths. These values differ when ligatures or complex scripts reduce the glyph count relative to the code point count, causing incorrect overhang/bounds calculations. --- Topten.RichTextKit/FontRun.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Topten.RichTextKit/FontRun.cs b/Topten.RichTextKit/FontRun.cs index a97068f..7eaf8c2 100644 --- a/Topten.RichTextKit/FontRun.cs +++ b/Topten.RichTextKit/FontRun.cs @@ -1,4 +1,4 @@ -#define USE_SKTEXTBLOB +#define USE_SKTEXTBLOB // RichTextKit // Copyright © 2019-2020 Topten Software. All Rights Reserved. // @@ -518,7 +518,7 @@ internal void UpdateOverhang(float right, bool updateTop, bool updateBottom, ref { fixed (ushort* pGlyphs = Glyphs.Underlying) { - paint.GetGlyphWidths((IntPtr)(pGlyphs + Start), sizeof(ushort) * Glyphs.Length, out var bounds); + paint.GetGlyphWidths((IntPtr)(pGlyphs + Glyphs.Start), sizeof(ushort) * Glyphs.Length, out var bounds); if (bounds != null) { for (int i = 0; i < bounds.Length; i++)