From b312ab22b81e57e97302d09d91102f205bc27e7d Mon Sep 17 00:00:00 2001 From: Jon Lipsky Date: Wed, 30 Apr 2025 12:50:53 -0700 Subject: [PATCH 1/3] Added PostScriptName property --- binding/SkiaSharp/SKTypeface.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/binding/SkiaSharp/SKTypeface.cs b/binding/SkiaSharp/SKTypeface.cs index 098628cb21..79499d9a31 100644 --- a/binding/SkiaSharp/SKTypeface.cs +++ b/binding/SkiaSharp/SKTypeface.cs @@ -142,6 +142,8 @@ public static SKTypeface FromData (SKData data, int index = 0) public int GlyphCount => SkiaApi.sk_typeface_count_glyphs (Handle); + public string PostScriptName => (string)SKString.GetObject (SkiaApi.sk_typeface_get_post_script_name (Handle)); + // GetTableTags public int TableCount => SkiaApi.sk_typeface_count_tables (Handle); From 2b3f5bf292e1c95dd5a8647ff3a49ebb59d4d770 Mon Sep 17 00:00:00 2001 From: Jeremy Powell <47993233+jeremy-visionaid@users.noreply.github.com> Date: Fri, 2 May 2025 04:34:59 +1200 Subject: [PATCH 2/3] Avoid initializing SKMetalView twice (#3256) --- .../SkiaSharp.Views/Platform/Apple/SKMetalView.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/source/SkiaSharp.Views/SkiaSharp.Views/Platform/Apple/SKMetalView.cs b/source/SkiaSharp.Views/SkiaSharp.Views/Platform/Apple/SKMetalView.cs index 30e5754aa7..4010005b41 100644 --- a/source/SkiaSharp.Views/SkiaSharp.Views/Platform/Apple/SKMetalView.cs +++ b/source/SkiaSharp.Views/SkiaSharp.Views/Platform/Apple/SKMetalView.cs @@ -48,7 +48,6 @@ event EventHandler IComponent.Disposed public SKMetalView() : this(CGRect.Empty) { - Initialize(); } // created in code From 2b7b9f3487871e5417072d53e34d63ba75237cf2 Mon Sep 17 00:00:00 2001 From: Jon Lipsky Date: Thu, 1 May 2025 13:52:11 -0700 Subject: [PATCH 3/3] Added unit test --- binding/SkiaSharp/SkiaApi.generated.cs | 19 +++++++++++++++++++ externals/skia | 2 +- tests/Tests/SkiaSharp/SKTypefaceTest.cs | 9 +++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) mode change 160000 => 120000 externals/skia diff --git a/binding/SkiaSharp/SkiaApi.generated.cs b/binding/SkiaSharp/SkiaApi.generated.cs index 54c68a436f..1773c6fe9e 100644 --- a/binding/SkiaSharp/SkiaApi.generated.cs +++ b/binding/SkiaSharp/SkiaApi.generated.cs @@ -16471,6 +16471,25 @@ internal static sk_string_t sk_typeface_get_family_name (sk_typeface_t typeface) (sk_typeface_get_family_name_delegate ??= GetSymbol ("sk_typeface_get_family_name")).Invoke (typeface); #endif + // sk_string_t* sk_typeface_get_post_script_name(const sk_typeface_t* typeface) + #if !USE_DELEGATES + #if USE_LIBRARY_IMPORT + [LibraryImport (SKIA)] + internal static partial sk_string_t sk_typeface_get_post_script_name (sk_typeface_t typeface); + #else // !USE_LIBRARY_IMPORT + [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)] + internal static extern sk_string_t sk_typeface_get_post_script_name (sk_typeface_t typeface); + #endif + #else + private partial class Delegates { + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] + internal delegate sk_string_t sk_typeface_get_post_script_name (sk_typeface_t typeface); + } + private static Delegates.sk_typeface_get_post_script_name sk_typeface_get_post_script_name_delegate; + internal static sk_string_t sk_typeface_get_post_script_name (sk_typeface_t typeface) => + (sk_typeface_get_post_script_name_delegate ??= GetSymbol ("sk_typeface_get_post_script_name")).Invoke (typeface); + #endif + // sk_font_style_slant_t sk_typeface_get_font_slant(const sk_typeface_t* typeface) #if !USE_DELEGATES #if USE_LIBRARY_IMPORT diff --git a/externals/skia b/externals/skia deleted file mode 160000 index 30abf4a0dc..0000000000 --- a/externals/skia +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 30abf4a0dcd3006f3a555e46906151e486f87b6e diff --git a/externals/skia b/externals/skia new file mode 120000 index 0000000000..fc7af82f06 --- /dev/null +++ b/externals/skia @@ -0,0 +1 @@ +/Users/jlipsky/Development/GitHub/skia \ No newline at end of file diff --git a/tests/Tests/SkiaSharp/SKTypefaceTest.cs b/tests/Tests/SkiaSharp/SKTypefaceTest.cs index 18978e0a10..d19da35991 100644 --- a/tests/Tests/SkiaSharp/SKTypefaceTest.cs +++ b/tests/Tests/SkiaSharp/SKTypefaceTest.cs @@ -55,6 +55,15 @@ public void TestIsFixedPitch() } } + [SkippableFact] + public void TestPostScriptName() + { + using (var typeface = SKTypeface.FromFile(Path.Combine(PathToFonts, "CourierNew.ttf"))) + { + Assert.Equal("CourierNewPSMT", typeface.PostScriptName); + } + } + [SkippableFact] public void CanReadNonASCIIFile() {