Quoting the Apple documentation.
On iOS 6, we have added the capability for applications to download fonts on demand. Besides the fonts installed with iOS 6, applications can install a list of additional fonts as necessary.
Here is a simplified version of how to download fonts. The sample code from Apple can be downloaded below.
- (void)asynchronouslySetFontName:(NSString *)fontName toTextView:(UITextView *)textView {
CGFloat size = 24.0f;
UIFont *font = [UIFont fontWithName:fontName size:size];
if (font && ([font.fontName compare:fontName] == NSOrderedSame || [font.familyName compare:fontName] == NSOrderedSame)) {
textView.font = font;
return;
}
NSMutableDictionary *attrs = [NSMutableDictionary dictionaryWithObject:fontName forKey:kCTFontNameAttribute];
CTFontDescriptorRef desc = CTFontDescriptorCreateWithAttributes((__bridge CFDictionaryRef)attrs);
NSMutableArray *descs = [NSMutableArray array];
[descs addObject:(__bridge id)desc];
CFRelease(desc);
__weak UITextView *weakTextView = textView;
CTFontDescriptorMatchFontDescriptorsWithProgressHandler((__bridge CFArrayRef)descs, NULL, ^(CTFontDescriptorMatchingState state, CFDictionaryRef progressParameter) {
if (state == kCTFontDescriptorMatchingDidFinish) {
dispatch_async(dispatch_get_main_queue(), ^{
weakTextView.font = [UIFont fontWithName:fontName size:size];
});
}
return YES;
});
}