CTFontManager.RegisterGraphicsFont(CGFont, NSError) Method

Definition

public static bool RegisterGraphicsFont (CoreGraphics.CGFont font, out Foundation.NSError error);
static member RegisterGraphicsFont : CoreGraphics.CGFont *  -> bool

Parameters

font
CGFont

The CoreGraphics font to register with the CoreText font system.

error
NSError

On return the error, if any.

Returns

True on success, false on error.

Remarks

You can use this feature to register fonts that you download from the network, or to use fonts that are for example embedded as a resource in your executable or some other database.

// 
// Load font into byte array from a file.
//
byte [] myBuffer = GetEmbeddedResource ("myResource");
CGFont font = CGFont.CreateFromProvider (new CGDataProvider (myBuffer, 0, myBuffer.Count));
if (CTFontManager.RegisterGraphicsFont (font, out error)){
	//
	// access font
	//

	// Release font after we use it.
	CTFontManager.UnregisterGraphicsFont (font, out error);
}

Applies to