The stream cannot be referenced/disposed once passed to SKTypeface.

This commit is contained in:
Matthew Leibowitz 2016-06-06 19:43:57 +02:00
Родитель d84e8e645f
Коммит 91db24bc94
3 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -228,15 +228,15 @@
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="stream">Input stream</param>
<param name="index">the font face index.</param>
<summary>Return a new typeface given a stream. </summary>
<param name="stream">The input stream.</param>
<param name="index">The font face index.</param>
<summary>Return a new typeface given a stream. Ownership of the stream is transferred, so the caller must not reference it again.</summary>
<returns>If the stream is not a valid font file, returns <paramref name="null" />. </returns>
<remarks>
<para>
</para>
<example>
<code lang="C#"><![CDATA[using (var stream = new SKFileStream (“myfont.ttf"))
<code lang="C#"><![CDATA[var stream = new SKFileStream (“myfont.ttf”);
using (var tf = SKTypeface.FromStream (stream)) {
paint.Color = XamDkBlue;
paint.TextSize = 60;

Просмотреть файл

@ -289,8 +289,8 @@ namespace SkiaSharp
canvas.DrawText (text, 50, 50, paint);
}
using (var stream = new SKFileStream (CustomFontPath))
using (var tf = SKTypeface.FromStream (stream)) {
var fileStream = new SKFileStream (CustomFontPath);
using (var tf = SKTypeface.FromStream (fileStream)) {
paint.Color = XamDkBlue;
paint.TextSize = 60;
paint.Typeface = tf;
@ -305,7 +305,7 @@ namespace SkiaSharp
using (var memory = new MemoryStream ()) {
resource.CopyTo (memory);
var bytes = memory.ToArray ();
using (var stream = new SKMemoryStream (bytes))
var stream = new SKMemoryStream (bytes);
using (var tf = SKTypeface.FromStream (stream)) {
paint.Color = XamLtBlue;
paint.TextSize = 60;
@ -315,9 +315,9 @@ namespace SkiaSharp
}
}
using (var resource = assembly.GetManifestResourceStream (fontName))
using (var stream = new SKManagedStream (resource))
using (var tf = SKTypeface.FromStream (stream)) {
var managedResource = assembly.GetManifestResourceStream (fontName);
var managedStream = new SKManagedStream (managedResource, true);
using (var tf = SKTypeface.FromStream (managedStream)) {
paint.Color = XamPurple;
paint.TextSize = 60;
paint.Typeface = tf;

2
skia

@ -1 +1 @@
Subproject commit deb4a7997785aa732d385d4dab2d799fb29033aa
Subproject commit 6fde4a60e6d70be6b78935a9b33a7b509e23e73e