public static SKTypeface GetTypeface(string fullFontName) { SKTypeface result; if (typefaceCache == null) { typefaceCache = new Dictionary <string, SKTypeface>(); } else { if (typefaceCache.TryGetValue(fullFontName, out result)) { return(result); } } var assembly = Assembly.GetExecutingAssembly(); var stream = assembly.GetManifestResourceStream("PaintCodeResources.Fonts." + fullFontName); result = SKTypeface.FromStream(stream); typefaceCache[fullFontName] = result; return(result); }
public static SKTypeface GetFontFamily(Assembly assembly) { if (fontFamily != null) { return(fontFamily); } try { string resourceID = "MapsXF.Resources.Fonts.OpenSans-Regular.ttf"; using Stream stream = assembly.GetManifestResourceStream(resourceID); fontFamily = SKTypeface.FromStream(stream); stream.Close(); } catch (Exception ex) { ex.Print(); fontFamily = SKTypeface.Default; } return(fontFamily); }
public static SKTypeface GetFontFamily(Assembly assembly, bool isBold = false) { if (fontFamily != null) { return(fontFamily); } try { string resourceID = isBold ? "Architecture.Resources.Fonts.Poppins-SemiBold.ttf" : "Architecture.Resources.Fonts.Poppins-Regular.ttf"; using Stream stream = assembly.GetManifestResourceStream(resourceID); fontFamily = SKTypeface.FromStream(stream); stream.Close(); } catch (Exception ex) { ex.Print(); fontFamily = SKTypeface.Default; } return(fontFamily); }
private static SKTypeface GetResourceFontSK(String ResourceName) { if (LoadedSKFonts.ContainsKey(ResourceName)) { return(LoadedSKFonts[ResourceName]); } else { SKTypeface result; var assembly = Assembly.GetExecutingAssembly(); var stream = assembly.GetManifestResourceStream(ResourceName); if (stream == null) { return(null); } result = SKTypeface.FromStream(stream); if (result != null) { LoadedSKFonts.Add(ResourceName, result); } return(result); } }
public Monitor() { EnableTouchEvents = true; _paint = new SKPaint() { IsAntialias = true }; _indicatorPaint = new SKPaint() { IsAntialias = true }; _textPaint = new SKPaint() { IsAntialias = true, IsStroke = true, }; var assembly = IntrospectionExtensions.GetTypeInfo(typeof(Monitor)).Assembly; var stream = assembly.GetManifestResourceStream("XRobot.Resources.Fonts.OriginTech.ttf"); _typeface = SKTypeface.FromStream(stream); SizeChanged += (s, a) => InvalidateSurface(); }
private void OnPainting(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e) { // we get the current surface from the event args var surface = e.Surface; // then we get the canvas that we can draw on var canvas = surface.Canvas; // clear the canvas / view canvas.Clear(SKColors.White); // create the paint for the text var textPaint = new SKPaint { IsAntialias = true, Style = SKPaintStyle.Fill, Color = SKColors.Navy, TextSize = 80 }; // draw the text (from the baseline) canvas.DrawText("SkiaSharp", 60, 160 + 80, textPaint); textPaint.Typeface = SKTypeface.FromStream(GetStreamFromResources(typeof(SkiaPage), "XFCustomFonts.Fonts.IconFont.ttf")); canvas.DrawText(ZPFFonts.IF.GetContent(ZPFFonts.IF.ZPF), 60, 160 + 80 + 80, textPaint); }
public AlphaCircleGraph() { // ※iOS 版では Font だけ残して他はこの場で Dispose() して構わないが Android 版では遅延処理が行われるようでそれだと disposed object へのアクセスが発生してしまう。 FontSource = AlphaFactory.GetApp().GetFontStream(); FontStream = new SKManagedStream(FontSource); Font = SKTypeface.FromStream(FontStream); }
/// <summary> /// Creates the custom font collection. /// </summary> /// <param name="fontFamily">The font family.</param> /// <returns>SKTypefaceCollection.</returns> /// <exception cref="InvalidOperationException">Asset could not be loaded.</exception> /// <exception cref="InvalidOperationException">Asset could not be loaded.</exception> private static SKTypefaceCollection CreateCustomFontCollection(FontFamily fontFamily) { var fontAssets = FontFamilyLoader.LoadFontAssets(fontFamily.Key); var typeFaceCollection = new SKTypefaceCollection(); var assetLoader = AvaloniaLocator.Current.GetService <IAssetLoader>(); foreach (var asset in fontAssets) { var assetStream = assetLoader.Open(asset); if (assetStream == null) { throw new InvalidOperationException("Asset could not be loaded."); } var typeface = SKTypeface.FromStream(assetStream); if (typeface == null) { return(null); } if (typeface.FamilyName != fontFamily.Name) { continue; } var key = new Typeface(fontFamily, typeface.FontSlant.ToAvalonia(), (FontWeight)typeface.FontWeight); typeFaceCollection.AddTypeface(key, typeface); } return(typeFaceCollection); }
/// <summary> /// 绘制字符 /// </summary> private void CreateChar(SKCanvas canvas, string c, int index) { using (SKPaint paint = new SKPaint()) { paint.TextSize = 25; // 字体大小 paint.IsAntialias = true; // 开启抗锯齿 paint.Color = SKColors.Red; byte[] font = this.Font; int angle = RandomHelper.GetIntNumber(-15, 15); //旋转角度 using (MemoryStream stream = new MemoryStream(font)) { paint.Typeface = SKTypeface.FromStream(stream); // 设置字体 SKRect textSize = new SKRect(); paint.MeasureText(c, ref textSize); float margin = 5; float charWidth = (Width - margin) / Code.Length; float charX = charWidth * index + margin; float charY = Height - (Height - textSize.Size.Height) / 2; List <SKColor> colors = new List <SKColor>(); colors.Add(this.GetRandomColor(0, 200)); colors.Add(this.GetRandomColor(0, 200)); paint.Shader = SKShader.CreateLinearGradient(new SKPoint(charX, Height / 2), new SKPoint(charX + textSize.Width, Height / 2), colors.ToArray(), new float[] { 0, 1 }, SKShaderTileMode.Repeat); canvas.RotateDegrees(angle, charX, charY); canvas.DrawText(c, charX, charY, paint); canvas.RotateDegrees(-angle, charX, charY); } } }
public void ManagedStreamIsAccessableFromNativeType() { var paint = CreatePaint(); CollectGarbage(); var tf = paint.Typeface; Assert.Equal("Roboto2", tf.FamilyName); Assert.True(tf.TryGetTableTags(out var tags)); Assert.NotEmpty(tags); SKPaint CreatePaint() { var bytes = File.ReadAllBytes(Path.Combine(PathToFonts, "Roboto2-Regular_NoEmbed.ttf")); var dotnet = new MemoryStream(bytes); var stream = new SKManagedStream(dotnet, true); var typeface = SKTypeface.FromStream(stream); return(new SKPaint { Typeface = typeface }); } }
public void StreamIsAccessableFromNativeType() { VerifyImmediateFinalizers(); var paint = CreatePaint(out var typefaceHandle); CollectGarbage(); Assert.False(SKObject.GetInstance <SKTypeface>(typefaceHandle, out _)); var tf = paint.Typeface; Assert.Equal("Roboto2", tf.FamilyName); Assert.True(tf.TryGetTableTags(out var tags)); Assert.NotEmpty(tags); SKPaint CreatePaint(out IntPtr handle) { var bytes = File.ReadAllBytes(Path.Combine(PathToFonts, "Roboto2-Regular_NoEmbed.ttf")); var dotnet = new MemoryStream(bytes); var stream = new SKManagedStream(dotnet, true); var typeface = SKTypeface.FromStream(stream); handle = typeface.Handle; return(new SKPaint { Typeface = typeface }); } }
private void uiPanel_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e) { // http://zawapro.com/?p=2000 var canvas = e.Surface.Canvas; if (results == null) { return; } blackPen.Typeface = SKTypeface.FromStream( new SKManagedStream( typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("OcrTest2.Fonts.NotoSansCJKjp-Regular.otf") ) ); foreach (var region in results.Regions) { canvas.DrawRect(region.Rectangle.ToSKRect(), redPen); foreach (var line in region.Lines) { canvas.DrawRect(line.Rectangle.ToSKRect(), greenPen); foreach (var word in line.Words) { canvas.DrawRect(word.Rectangle.ToSKRect(), bluePen); canvas.DrawText(word.Text, word.Rectangle.Left, word.Rectangle.Top, blackPen); } } } }
/// <summary> /// アスペクトを描画 /// </summary> /// <param name="cvs">Cvs.</param> /// <param name="info">Info.</param> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="aspectLine">Aspect line.</param> /// <param name="symbol">Symbol.</param> public void DrawAspect(SKCanvas cvs, AspectInfo info, Position from, Position to, SKPaint aspectLine, SKPaint symbol) { System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); SKManagedStream stream = new SKManagedStream(asm.GetManifestResourceStream("microcosm.system.AstroDotBasic.ttf")); { symbol.Typeface = SKTypeface.FromStream(stream); /* * p.TextSize = 48; * Position signValuePt; * SKColor pink = SKColors.Pink; * p.Color = pink; * for (int i = 0; i < signs.Length; i++) * { * signValuePt = Util.Rotate(diameter - 30, 0, 15 + 30 * i - ringsData[0].cusps[1]); * signValuePt.x = signValuePt.x + CenterX - 15; * signValuePt.y = -1 * signValuePt.y + CenterY + 20; * p.Color = CommonData.getSignColor(30 * i); * cvs.DrawText(signs[i], (float)signValuePt.x, (float)signValuePt.y, p); * } * p.Color = SKColors.Black; */ Console.WriteLine(info.aspectKind.ToString()); Console.WriteLine(info.absoluteDegree); Console.WriteLine(info.targetDegree); Console.WriteLine(""); cvs.DrawLine((float)from.x, (float)from.y, (float)to.x, (float)to.y, aspectLine); cvs.DrawText(CommonData.getAspectSymbol(info.aspectKind), (float)((from.x + to.x) / 2), (float)((from.y + to.y) / 2), symbol); } }
private static void ObtainFont() { byte[] font = Resources.Properties.Resources.Chiaro; var stream = new SKManagedStream(new MemoryStream(font)); typeface = SKTypeface.FromStream(stream); }
static SkiaCanvas() { var type = typeof(SkiaCanvas).GetTypeInfo(); var bravura = type.Assembly.GetManifestResourceStream(type.Namespace + ".Bravura.ttf"); { MusicFont = SKTypeface.FromStream(bravura); } }
protected override void OnDrawSample(SKCanvas canvas, int width, int height) { string text = "\u03A3 and \u0750"; canvas.Clear(SKColors.White); using (var paint = new SKPaint()) { paint.IsAntialias = true; using (var tf = SKTypeface.FromFile(SampleMedia.Fonts.ContentFontPath)) { paint.Color = SampleMedia.Colors.XamarinGreen; paint.TextSize = 60; paint.Typeface = tf; canvas.DrawText(text, 50, 50, paint); } using (var fileStream = new SKFileStream(SampleMedia.Fonts.ContentFontPath)) using (var tf = SKTypeface.FromStream(fileStream)) { paint.Color = SampleMedia.Colors.XamarinDarkBlue; paint.TextSize = 60; paint.Typeface = tf; canvas.DrawText(text, 50, 100, paint); } using (var resource = SampleMedia.Fonts.EmbeddedFont) using (var memory = new MemoryStream()) { resource.CopyTo(memory); var bytes = memory.ToArray(); using (var stream = new SKMemoryStream(bytes)) using (var tf = SKTypeface.FromStream(stream)) { paint.Color = SampleMedia.Colors.XamarinLightBlue; paint.TextSize = 60; paint.Typeface = tf; canvas.DrawText(text, 50, 150, paint); } } using (var managedResource = SampleMedia.Fonts.EmbeddedFont) using (var managedStream = new SKManagedStream(managedResource, true)) using (var tf = SKTypeface.FromStream(managedStream)) { paint.Color = SampleMedia.Colors.XamarinPurple; paint.TextSize = 60; paint.Typeface = tf; canvas.DrawText(text, 50, 200, paint); } } }
public void CanReadNonSeekableStream() { using (var stream = File.OpenRead(Path.Combine(PathToFonts, "Distortable.ttf"))) using (var nonSeekable = new NonSeekableReadOnlyStream(stream)) using (var typeface = SKTypeface.FromStream(nonSeekable)) { Assert.NotNull(typeface); } }
private static SKTypeface LoadEmbeddedTypeFace() { var fileProvider = new EmbeddedFileProvider(typeof(TextElement).Assembly); var fileInfo = fileProvider.GetFileInfo("Roboto-Regular.ttf.gz"); using var stream = fileInfo.CreateReadStream(); using GZipStream decompressionStream = new GZipStream(stream, CompressionMode.Decompress); return(SKTypeface.FromStream(decompressionStream)); }
private void SKCanvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs args) { var vm = BindingContext as DiceRollerViewModel; var diceRoller = new DiceRollerViewModel(); var diceRolls = diceRoller.DicesValues(vm.Type, vm.Quantity); foreach (var diceRoll in diceRolls) { Debug.WriteLine($"{diceRoll.Key} => {diceRoll.Value / vm.Quantity}"); } SKImageInfo info = args.Info; SKSurface surface = args.Surface; SKCanvas canvas = surface.Canvas; float minx = diceRolls.Min(kv => kv.Value); float miny = diceRolls.Min(kv => kv.Key); float maxx = diceRolls.Max(kv => kv.Value); float maxy = diceRolls.Max(kv => kv.Key); float sumx = diceRolls.Sum(kv => kv.Value); float sizey = info.Height / (maxy - miny + 1); SKTypeface typeface = null; var inFont = AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.LinLibertine_R.ttf"); typeface = SKTypeface.FromStream(inFont); SKPaint strokePaint = new SKPaint() { Color = new SKColor(0x9B, 0x1C, 0x47), Style = SKPaintStyle.Stroke, StrokeWidth = 1, }; SKPaint strokeFont = new SKPaint() { Color = new SKColor(0x9B, 0x1C, 0x47), Style = SKPaintStyle.Stroke, StrokeWidth = 1, TextSize = sizey * 0.6f, Typeface = typeface }; canvas.Clear(); foreach (var diceRoll in diceRolls) { float x = diceRoll.Value; float y = diceRoll.Key; canvas.DrawRect(new SKRect(0, ((y - miny) * sizey), x * info.Width / maxx, ((y - miny) * sizey) + sizey - 5), strokePaint); canvas.DrawText($"{y} => {x / sumx * 100:0.00}%", 10, ((y - miny) * sizey) + sizey * 0.6f, strokeFont); } typeface.Dispose(); strokeFont.Dispose(); strokePaint.Dispose(); }
public unsafe void FromStreamReturnsDifferentObject() { using var stream1 = File.OpenRead(Path.Combine(PathToFonts, "Roboto2-Regular_NoEmbed.ttf")); using var tf1 = SKTypeface.FromStream(stream1); using var stream2 = File.OpenRead(Path.Combine(PathToFonts, "Roboto2-Regular_NoEmbed.ttf")); using var tf2 = SKTypeface.FromStream(stream2); Assert.NotSame(tf1, tf2); }
public override SKTypeface GetTypeface(FontStyle fontStyle, int weight) { if (!(cachedTypeface != null && cachedTypeface.FontSlant == fontStyle.ToSKFontStyleSlant() && cachedTypeface.FontWeight == weight)) { var stream = _assembly.GetManifestResourceStream(_resource); cachedTypeface = SKTypeface.FromStream(stream); } return(cachedTypeface); }
private void OnPaintCanvas(object sender, SKPaintSurfaceEventArgs e) { SKImageInfo imageInfo = e.Info; SKSurface surface = e.Surface; SKCanvas canvas = surface.Canvas; canvas.Clear(); canvas.DrawBitmap(backgroundBitmap, new SKRect(0, 0, imageInfo.Width, imageInfo.Height)); SKTypeface typeface; using (var asset = Assets.Open("LittleBird.ttf")) { var fontStream = new MemoryStream(); asset.CopyTo(fontStream); fontStream.Flush(); fontStream.Position = 0; typeface = SKTypeface.FromStream(fontStream); } byte alpha = (byte)(100 + 155 * scale); SKPaint textPaint = new SKPaint { Style = SKPaintStyle.Fill, Typeface = typeface, Color = SKColors.White.WithAlpha(alpha), TextAlign = SKTextAlign.Right, TextSize = 64 }; canvas.DrawText("tap Screen to start playing...", imageInfo.Width - 20, imageInfo.Height / 6 * 5, textPaint); SKPaint rectPaint = new SKPaint { Style = SKPaintStyle.Fill, Color = SKColors.Black.WithAlpha(100) }; SKPaint scorePaint = new SKPaint { Color = SKColors.White, TextAlign = SKTextAlign.Right, TextSize = 32, Typeface = typeface }; scoreButton = new SKRect(imageInfo.Width - scorePaint.MeasureText("Ranking") - 30, 10, imageInfo.Width - 10, 68); canvas.DrawRoundRect(scoreButton, 5, 5, rectPaint); canvas.DrawText("Ranking", imageInfo.Width - 20, 48, scorePaint); if (username != "") { SKPaint usernamePaint = textPaint; usernamePaint.TextSize = 32; usernamePaint.Color = SKColors.Black; canvas.DrawText(username, scoreButton.Left - 20, 48, usernamePaint); } }
static SKTypeface CreateFont(string file) { var stream = ResourceAssembly.GetManifestResourceStream("Sample.Assets." + file); if (stream == null) { return(SKTypeface.Default); } return(SKTypeface.FromStream(stream)); }
private SKTypeface GetTypeface(string name) { var type = typeof(MainPage).GetTypeInfo(); var assembly = type.Assembly; var stream = assembly.GetManifestResourceStream($"SkiaSharpDemo.fonts.{name}.ttf"); var tf = SKTypeface.FromStream(stream); loadedFonts[name] = tf; return(tf); }
public SKTypeface OnTheFly(string path) { if (!_viewModel.Provider.TrySaveAsset(path, out var data)) { return(Default); } var m = new MemoryStream(data) { Position = 0 }; return(SKTypeface.FromStream(m)); }
public unsafe void ManagedStreamIsCollectedWhenTypefaceIsDisposed() { var bytes = File.ReadAllBytes(Path.Combine(PathToFonts, "Distortable.ttf")); var dotnet = new MemoryStream(bytes); var stream = new SKManagedStream(dotnet, true); var handle = stream.Handle; var typeface = SKTypeface.FromStream(stream); typeface.Dispose(); Assert.False(SKObject.GetInstance <SKManagedStream>(handle, out _)); Assert.Throws <ObjectDisposedException>(() => dotnet.Position); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); Window.AllowEnterTransitionOverlap = true; Window.EnterTransition = new Fade(); Window.SharedElementEnterTransition = new Fade(); Window.RequestFeature(WindowFeatures.ContentTransitions); SetContentView(Resource.Layout.GameScreen); FindViewById <SKCanvasView>(Resource.Id.canvasView).Touch += OnScreenTouched; Random rnd = new Random(); theme = rnd.Next(0, 4); tick_duration_ms = 5; godmode = false; startTimer(); score = 0; canvasView = FindViewById <SKCanvasView>(Resource.Id.canvasView); canvasView.PaintSurface += OnCanvasViewPaintSurface; background = new ObjBackground(this, theme); player = new ObjPlayer(this); gameObjects = new List <GameObject>(); gameObjects.Add(background); gameObjects.Add(player); archievedEvents = new List <gameevent>((int)gameevent.GAME_STARTED); eventHandler = new GameEventHandler(this, archievedEvents); using (var asset = Assets.Open("LittleBird.ttf")) { var fontStream = new MemoryStream(); asset.CopyTo(fontStream); fontStream.Flush(); fontStream.Position = 0; typeface = SKTypeface.FromStream(fontStream); } }
public SKTypeface GetTypeface(string name) { var nativeFontService = Fonts.GlobalService; if (string.IsNullOrEmpty(name)) { var style = nativeFontService.GetDefaultFontStyle(); name = style.Name; } if (!_typeFaces.TryGetValue(name, out var typeface)) { try { var fontStyle = nativeFontService.GetFontStyleById(name); var stream = fontStyle?.OpenStream(); if (stream != null) { typeface = SKTypeface.FromStream(new SKManagedStream(stream)); } else if (fontStyle != null) { var slant = SKFontStyleSlant.Upright; if (fontStyle.StyleType == FontStyleType.Italic) { slant = SKFontStyleSlant.Italic; } else if (fontStyle.StyleType == FontStyleType.Oblique) { slant = SKFontStyleSlant.Oblique; } typeface = SKTypeface.FromFamilyName(fontStyle.FontFamily.Name, fontStyle.Weight, (int)SKFontStyleWidth.Normal, slant); } if (typeface != null) { _typeFaces[name] = typeface; } } catch (Exception exc) { Logger.Info("Unable to load typeface [{0}]" + name, exc); } } return(typeface); }
public GlobalCache(PakIndex index) { Index = index; VBucksIcon = index.GetPackage("/FortniteGame/Content/UI/Foundation/Shell/Textures/T-Icon-VBucks-L").GetExport <Texture2D>().Image; var img = index.GetPackage("/FortniteGame/Content/VisualThreatManager/StormVisuals/Test/SpawnParticles/Streamers/LowResBlurredNoise").GetExport <Texture2D>().Image; // don't dispose objects given by exports using (var b = SKBitmap.FromImage(img)) using (var b2 = new SKBitmap(new SKImageInfo(b.Width * 2, b.Height * 2), SKBitmapAllocFlags.ZeroPixels)) { using (var c = new SKCanvas(b2)) using (var s = SKShader.CreateColorFilter(SKShader.CreateBitmap(b, SKShaderTileMode.Repeat, SKShaderTileMode.Repeat), SKColorFilter.CreateLighting(new SKColor(160, 160, 160), new SKColor(15, 15, 15)))) { c.DrawRect(0, 0, b2.Width, b2.Height, new SKPaint { Shader = s }); } using (var borderNoiseBig = b2.Resize(new SKImageInfo(b2.Width * 16, b2.Height * 16), SKFilterQuality.Medium)) using (var borderNoise = new SKBitmap(b.Width * 16, b.Width * 16)) { borderNoiseBig.ExtractSubset(borderNoise, new SKRectI(b2.Width * 4, b2.Width * 4, b2.Width * 12, b2.Width * 12)); BaseBorderShader = SKShader.CreateBitmap(borderNoise, SKShaderTileMode.Repeat, SKShaderTileMode.Repeat); } } NameTypeface = SKTypeface.FromStream(index.GetFile("/FortniteGame/Content/UI/Foundation/Fonts/BurbankBigCondensed-Black.ufont").AsStream()); ShortDescriptionTypeface = SKTypeface.FromStream(index.GetFile("/FortniteGame/Content/UI/Foundation/Fonts/NotoSans-Regular.ufont").AsStream()); PriceTypeface = SKTypeface.FromStream(index.GetFile("/FortniteGame/Content/UI/Foundation/Fonts/NotoSans-Bold.ufont").AsStream()); CategoryTypeface = SKTypeface.FromStream(index.GetFile("/FortniteGame/Content/UI/Foundation/Fonts/NotoSans-Bold.ufont").AsStream()); ImagePaint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High }; { var types = EnumHelper <DrawType> .Values; SectionCaches = new SectionCache[types.Length]; for (int i = 0; i < types.Length; i++) { SectionCaches[i] = new SectionCache(types[i], this); } } { RarityColors = new ColorPalette[] { new ColorPalette(this, default, new SKColor(150, 150, 150), new SKColor(50, 53, 58), new SKColor(212, 212, 212), new SKColor(249, 249, 249)), // COMMON
public unsafe void InvalidStreamIsDisposedImmediately() { var stream = CreateTestSKStream(); var handle = stream.Handle; Assert.True(stream.OwnsHandle); Assert.False(stream.IgnorePublicDispose); Assert.True(SKObject.GetInstance <SKStream>(handle, out _)); Assert.Null(SKTypeface.FromStream(stream)); Assert.False(stream.OwnsHandle); Assert.True(stream.IgnorePublicDispose); Assert.False(SKObject.GetInstance <SKStream>(handle, out _)); }