Skip to content

Added PostScriptName property to SkTypeface #3261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions binding/SkiaSharp/SKTypeface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
19 changes: 19 additions & 0 deletions binding/SkiaSharp/SkiaApi.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Delegates.sk_typeface_get_family_name> ("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<Delegates.sk_typeface_get_post_script_name> ("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
Expand Down
1 change: 0 additions & 1 deletion externals/skia
Submodule skia deleted from 30abf4
1 change: 1 addition & 0 deletions externals/skia
9 changes: 9 additions & 0 deletions tests/Tests/SkiaSharp/SKTypefaceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down