All Projects → mattt → Uifontserialization

mattt / Uifontserialization

Licence: mit
Encode and decode between UIFont and Postscript font data

UIFontSerialization

UIFontSerialization encodes and decodes between UIFont and Postscript font data, following the API conventions of Foundation's NSJSONSerialization class.

Usage

Decoding

NSURL *fontFileURL = [[NSBundle mainBundle] URLForResource:@"font" withExtension:@"tty"];
NSData *data = [NSData dataWithContentsOfURL:fontFileURL];
UIFont *font = [UIFontSerialization fontWithData:data error:nil];

Encoding

UIFont *font = [UIFont systemFontOfSize:24]
NSData *data = [UIFontSerialization dataWithFont:font error:nil];

Contact

Mattt Thompson

License

UIFontSerialization is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].