public static SKTypeface FromStream (SKStreamAsset stream, int index = 0) { if (stream == null) throw new ArgumentNullException (nameof (stream)); var typeface = GetObject<SKTypeface> (SkiaApi.sk_typeface_create_from_stream (stream.Handle, index)); stream.RevokeOwnership (typeface); return typeface; }
public static SKTypeface FromStream(SKStreamAsset stream, int index = 0) { if (stream == null) { throw new ArgumentNullException("stream"); } var typeface = GetObject <SKTypeface> (SkiaApi.sk_typeface_create_from_stream(stream.Handle, index)); stream.RevokeOwnership(typeface); return(typeface); }
public SKTypeface CreateTypeface(SKStreamAsset stream, int index = 0) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } var typeface = GetObject <SKTypeface> (SkiaApi.sk_fontmgr_create_from_stream(Handle, stream.Handle, index)); stream.RevokeOwnership(); return(typeface); }
public SKTypeface CreateTypeface(SKStreamAsset stream, int index = 0) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (stream is SKManagedStream managed) { stream = managed.ToMemoryStream(); managed.Dispose(); } var typeface = SKTypeface.GetObject(SkiaApi.sk_fontmgr_create_from_stream(Handle, stream.Handle, index)); stream.RevokeOwnership(typeface); return(typeface); }