From 6f41c4494c603ed7e9ec3ef70a52bf349762a9cb Mon Sep 17 00:00:00 2001 From: hflex Date: Fri, 30 Oct 2026 22:31:08 +0400 Subject: [PATCH 1/3] Upgrade NuGet packages - SkiaSharp / SkiaSharp.Views.Maui.Controls / SkiaSharp.NativeAssets.Linux 4.153.1 -> 4.154.0 - HarfBuzzSharp / HarfBuzzSharp.NativeAssets.Linux 14.2.1.301 -> 14.2.1.400 - Pin MauiVersion to 10.0.120 (fixes Resizetizer MissingMethodException in 10.0.110) - Microsoft.Extensions.Logging.Debug 10.0.0 -> 10.0.14 - Microsoft.SourceLink.GitHub 10.0.402 -> 10.0.403 Co-Authored-By: Claude Opus 5.5 --- Directory.Build.props | 2 +- samples/SampleApp.Maui/SampleApp.Maui.csproj | 5 +++-- src/MintedTextEditor.Maui/MintedTextEditor.Maui.csproj | 3 ++- .../MintedTextEditor.SkiaSharp.csproj | 4 ++-- .../MintedTextEditor.SkiaSharp.Tests.csproj | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 5f6a42b..24a4b63 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -52,6 +52,6 @@ - + diff --git a/samples/SampleApp.Maui/SampleApp.Maui.csproj b/samples/SampleApp.Maui/SampleApp.Maui.csproj index 19a32d3..fad53a8 100644 --- a/samples/SampleApp.Maui/SampleApp.Maui.csproj +++ b/samples/SampleApp.Maui/SampleApp.Maui.csproj @@ -2,6 +2,7 @@ net10.0-android;net10.0-ios;net10.0-maccatalyst + 10.0.120 $(TargetFrameworks);net10.0-windows10.0.19041.0 Exe @@ -49,8 +50,8 @@ - - + + diff --git a/src/MintedTextEditor.Maui/MintedTextEditor.Maui.csproj b/src/MintedTextEditor.Maui/MintedTextEditor.Maui.csproj index 87ff0fc..f44a27c 100644 --- a/src/MintedTextEditor.Maui/MintedTextEditor.Maui.csproj +++ b/src/MintedTextEditor.Maui/MintedTextEditor.Maui.csproj @@ -2,6 +2,7 @@ net10.0-android;net10.0-ios;net10.0-maccatalyst + 10.0.120 $(TargetFrameworks);net10.0-windows10.0.19041.0 true @@ -39,7 +40,7 @@ - + diff --git a/src/MintedTextEditor.SkiaSharp/MintedTextEditor.SkiaSharp.csproj b/src/MintedTextEditor.SkiaSharp/MintedTextEditor.SkiaSharp.csproj index d475226..9d8eca8 100644 --- a/src/MintedTextEditor.SkiaSharp/MintedTextEditor.SkiaSharp.csproj +++ b/src/MintedTextEditor.SkiaSharp/MintedTextEditor.SkiaSharp.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/tests/MintedTextEditor.SkiaSharp.Tests/MintedTextEditor.SkiaSharp.Tests.csproj b/tests/MintedTextEditor.SkiaSharp.Tests/MintedTextEditor.SkiaSharp.Tests.csproj index d9f8590..77a8d9d 100644 --- a/tests/MintedTextEditor.SkiaSharp.Tests/MintedTextEditor.SkiaSharp.Tests.csproj +++ b/tests/MintedTextEditor.SkiaSharp.Tests/MintedTextEditor.SkiaSharp.Tests.csproj @@ -13,8 +13,8 @@ - - + + From 82b2f90828324d6785d365820855e93edb9a374e Mon Sep 17 00:00:00 2001 From: hflex Date: Fri, 30 Oct 2026 22:45:35 +0400 Subject: [PATCH 2/3] Adopt UIScene lifecycle in sample app for iOS 27 Apps built with the iOS 27 SDK crash on launch without a scene manifest (UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption). Add the standard MAUI UIApplicationSceneManifest and a SceneDelegate deriving from MauiUISceneDelegate for iOS and Mac Catalyst. Co-Authored-By: Claude Opus 5.5 --- .../Platforms/MacCatalyst/Info.plist | 17 +++++++++++++++++ .../Platforms/MacCatalyst/SceneDelegate.cs | 10 ++++++++++ samples/SampleApp.Maui/Platforms/iOS/Info.plist | 17 +++++++++++++++++ .../Platforms/iOS/SceneDelegate.cs | 10 ++++++++++ 4 files changed, 54 insertions(+) create mode 100644 samples/SampleApp.Maui/Platforms/MacCatalyst/SceneDelegate.cs create mode 100644 samples/SampleApp.Maui/Platforms/iOS/SceneDelegate.cs diff --git a/samples/SampleApp.Maui/Platforms/MacCatalyst/Info.plist b/samples/SampleApp.Maui/Platforms/MacCatalyst/Info.plist index 37fcb9b..36bac62 100644 --- a/samples/SampleApp.Maui/Platforms/MacCatalyst/Info.plist +++ b/samples/SampleApp.Maui/Platforms/MacCatalyst/Info.plist @@ -16,6 +16,23 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + __MAUI_DEFAULT_SCENE_CONFIGURATION__ + UISceneDelegateClassName + SceneDelegate + + + + XSAppIconAssets Assets.xcassets/appicon.appiconset diff --git a/samples/SampleApp.Maui/Platforms/MacCatalyst/SceneDelegate.cs b/samples/SampleApp.Maui/Platforms/MacCatalyst/SceneDelegate.cs new file mode 100644 index 0000000..2961e1a --- /dev/null +++ b/samples/SampleApp.Maui/Platforms/MacCatalyst/SceneDelegate.cs @@ -0,0 +1,10 @@ +using Foundation; + +namespace SampleApp.Maui; + +// UIScene lifecycle entry point (required by the iOS 27 SDK). +// Referenced by UISceneDelegateClassName in Info.plist. +[Register("SceneDelegate")] +public class SceneDelegate : MauiUISceneDelegate +{ +} diff --git a/samples/SampleApp.Maui/Platforms/iOS/Info.plist b/samples/SampleApp.Maui/Platforms/iOS/Info.plist index c96dd0a..1a4af29 100644 --- a/samples/SampleApp.Maui/Platforms/iOS/Info.plist +++ b/samples/SampleApp.Maui/Platforms/iOS/Info.plist @@ -24,6 +24,23 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + __MAUI_DEFAULT_SCENE_CONFIGURATION__ + UISceneDelegateClassName + SceneDelegate + + + + XSAppIconAssets Assets.xcassets/appicon.appiconset diff --git a/samples/SampleApp.Maui/Platforms/iOS/SceneDelegate.cs b/samples/SampleApp.Maui/Platforms/iOS/SceneDelegate.cs new file mode 100644 index 0000000..2961e1a --- /dev/null +++ b/samples/SampleApp.Maui/Platforms/iOS/SceneDelegate.cs @@ -0,0 +1,10 @@ +using Foundation; + +namespace SampleApp.Maui; + +// UIScene lifecycle entry point (required by the iOS 27 SDK). +// Referenced by UISceneDelegateClassName in Info.plist. +[Register("SceneDelegate")] +public class SceneDelegate : MauiUISceneDelegate +{ +} From a9cd6fdef7d508c7ce4946e8d9c30be60be34b32 Mon Sep 17 00:00:00 2001 From: hflex Date: Fri, 30 Oct 2026 23:22:17 +0400 Subject: [PATCH 3/3] fix: caret between kerned letters on fonts with a legacy kern table HarfBuzz applies a legacy 'kern' table (e.g. Helvetica on iOS/macOS) by splitting the kerning between the first glyph's advance and the second glyph's x offset. The caret used the pen position and ignored the offset, so it landed halfway between the kerned and unkerned positions. Record each glyph's drawn x (pen + offset) instead. Fixes MeasureCaretOffset_IncludesKerningOfTheWholeRun on macOS. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 +++ src/MintedTextEditor.SkiaSharp/HarfBuzzTextShaper.cs | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b14fbff..187add5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +### Fixed +- The caret and hit-testing between kerned letters (e.g. "AV", "To") now match where the letters are drawn on fonts whose kerning HarfBuzz applies as a glyph offset, such as Helvetica on iOS and macOS. The caret previously landed halfway between the kerned and unkerned positions. + --- ## [0.4.0] — 2026-10-21 diff --git a/src/MintedTextEditor.SkiaSharp/HarfBuzzTextShaper.cs b/src/MintedTextEditor.SkiaSharp/HarfBuzzTextShaper.cs index 9586e59..faac57a 100644 --- a/src/MintedTextEditor.SkiaSharp/HarfBuzzTextShaper.cs +++ b/src/MintedTextEditor.SkiaSharp/HarfBuzzTextShaper.cs @@ -10,7 +10,7 @@ namespace MintedTextEditor.SkiaSharp; /// The glyphs and pen positions produced by shaping a string, ready to draw with the /// it was shaped for. Positions are relative to the run origin. /// Glyphs are in logical order; gives the UTF-16 index each glyph -/// starts at and the pen x before it. +/// starts at and the x it is drawn at (pen position plus its offset). /// internal sealed record ShapedRun(ushort[] Glyphs, SKPoint[] Positions, float Width, int[] Clusters, float[] GlyphX, int TextLength) { @@ -256,8 +256,13 @@ private ShapedRun ShapeUncached(string text, float size) { glyphs.Add((ushort)infos[i].Codepoint); clusters.Add((int)infos[i].Cluster); - glyphX.Add(penX); - points.Add(new SKPoint(penX + positions[i].XOffset * scale, -positions[i].YOffset * scale)); + // The caret goes where the glyph is drawn, so include its x offset: HarfBuzz + // applies a legacy 'kern' table (e.g. Helvetica on Apple platforms) by giving + // half the kerning to the first glyph's advance and moving the second glyph + // back by the rest, rather than adjusting the first advance alone. + float drawX = penX + positions[i].XOffset * scale; + glyphX.Add(drawX); + points.Add(new SKPoint(drawX, -positions[i].YOffset * scale)); penX += positions[i].XAdvance * scale; } }