CTFontManager.RegisterGraphicsFont(CGFont, NSError) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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);
}