Exposed SKTypeface.CreateDefault() and SKTypeface.Default to C#
This commit is contained in:
Родитель
310ebdd626
Коммит
35d3f00f55
|
@ -30,6 +30,13 @@ namespace SkiaSharp
|
|||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
public static SKTypeface Default => GetObject<SKTypeface> (SkiaApi.sk_typeface_ref_default ());
|
||||
|
||||
public static SKTypeface CreateDefault ()
|
||||
{
|
||||
return GetObject<SKTypeface> (SkiaApi.sk_typeface_create_default ());
|
||||
}
|
||||
|
||||
[Obsolete ("Use FromFamilyName(string, SKFontStyleWeight, SKFontStyleWidth, SKFontStyleSlant) instead.")]
|
||||
public static SKTypeface FromFamilyName (string familyName, SKTypefaceStyle style)
|
||||
{
|
||||
|
|
|
@ -977,6 +977,10 @@ namespace SkiaSharp
|
|||
|
||||
// typeface
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static sk_typeface_t sk_typeface_create_default();
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static sk_typeface_t sk_typeface_ref_default();
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static sk_typeface_t sk_typeface_create_from_name_with_font_style([MarshalAs(UnmanagedType.LPStr)] string familyName, sk_fontstyle_t style);
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static sk_typeface_t sk_typeface_create_from_file([MarshalAs(UnmanagedType.LPStr)] string path, int index);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1c582c77c986b63cdd81a560ae66d2d76d2b8c59
|
||||
Subproject commit 9564c28b08e0be4f763dd6243e09d4dc1b186dd1
|
|
@ -152,5 +152,23 @@ namespace SkiaSharp.Tests
|
|||
|
||||
Assert.NotNull(fonts.CreateStyleSet(0));
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void CanDisposeDefault()
|
||||
{
|
||||
// get the fist
|
||||
var fonts = SKFontManager.Default;
|
||||
Assert.NotNull(fonts);
|
||||
|
||||
// dispose and make sure that we didn't kill it
|
||||
fonts.Dispose();
|
||||
fonts = SKFontManager.Default;
|
||||
Assert.NotNull(fonts);
|
||||
|
||||
// dispose and make sure that we didn't kill it again
|
||||
fonts.Dispose();
|
||||
fonts = SKFontManager.Default;
|
||||
Assert.NotNull(fonts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,5 +146,23 @@ namespace SkiaSharp.Tests
|
|||
Assert.NotNull(typeface);
|
||||
}
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void CanDisposeDefault()
|
||||
{
|
||||
// get the fist
|
||||
var typeface = SKTypeface.Default;
|
||||
Assert.NotNull(typeface);
|
||||
|
||||
// dispose and make sure that we didn't kill it
|
||||
typeface.Dispose();
|
||||
typeface = SKTypeface.Default;
|
||||
Assert.NotNull(typeface);
|
||||
|
||||
// dispose and make sure that we didn't kill it again
|
||||
typeface.Dispose();
|
||||
typeface = SKTypeface.Default;
|
||||
Assert.NotNull(typeface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче