Reputation: 77596
I have a CTFontRef, how can i get the font name as a string?
Upvotes: 3
Views: 1116
Reputation: 22948
You'll need to be a bit more specific about what you mean by "font name". The PostScript name? Display name? Family name?
In any case, this is how you'd go about it:
NSString *postScriptName =
[(NSString *)CTFontCopyPostScriptName(fontRef) autorelease];
NSLog(@"postScriptName == %@", postScriptName);
CFStringRef
and NSString
are toll-free bridged (see Toll-Free Bridged Types).
Upvotes: 0
Reputation: 28720
There are methods defined for example.
Getting Font Names
CTFontCopyPostScriptName
CTFontCopyFamilyName
CTFontCopyFullName
CTFontCopyDisplayName
CTFontCopyName
CTFontCopyLocalizedName
Upvotes: 3