Skip to content

Instantly share code, notes, and snippets.

@chiahsien
Last active December 30, 2015 18:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiahsien/7867588 to your computer and use it in GitHub Desktop.
Save chiahsien/7867588 to your computer and use it in GitHub Desktop.
取得字體顯示名稱
#import <CoreText/CoreText.h> // Don't forget to import CoreText
NSArray *familyNames = [UIFont familyNames];
for (NSString *familyName in familyNames) {
NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
for (NSString *fontName in fontNames) {
CTFontRef fontRef = CTFontCreateWithName((__bridge CFStringRef)(fontName), 16, NULL);
NSString *displayName = CFBridgingRelease(CTFontCopyDisplayName(fontRef)); // Here's the magic...
NSLog(@"%@", displayName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment