Edit

Share via


CGFont.CreateFromProvider(CGDataProvider) Method

Definition

Creates a font from a data provider.

public static CoreGraphics.CGFont CreateFromProvider (CoreGraphics.CGDataProvider provider);
static member CreateFromProvider : CoreGraphics.CGDataProvider -> CoreGraphics.CGFont

Parameters

provider
CGDataProvider

Data provider that wraps the font.

Returns

The constructed font.

Remarks

You can use this method to create CGFonts from an in-memory representation of the font (for example, to embed binary fonts into your application to prevent easy copying of licensed fonts, or when you fetch the font from a streaming source and do not want to store it on disk).

// 
// Load font into byte array from a file.
//
byte [] myBuffer = File.ReadAllBytes ("demo.ttf"); 
CGFont font = CGFont.CreateFromProvider (new CGDataProvider (myBuffer, 0, myBuffer.Count));

Applies to