CoreText - Performance warning when creating a CTFont?

4.9k views Asked by At

I get the following warning when creating a CTFont.

CoreText performance note: Client requested font with PostScript name "ArialRoundedMTBold" using name "Arial Rounded MT Bold" instead.

// Creating Font
CTFontRef fontWithoutTrait = CTFontCreateWithName((__bridge CFStringRef)(name), size, NULL);

// Font names I use to create a font 
[UIFont familyNames];

Is it safe to assume that if I remove all spaces in any of the font names taken from [UIFont familyNames] it'll be the expected font-name by core text?

1

There are 1 answers

0
aryaxt On BEST ANSWER

Ended up converting full name to postscript name when creating the font.

+ (NSString *)postscriptNameFromFullName:(NSString *)fullName
{
    UIFont *font = [UIFont fontWithName:fullName size:1];
    return (__bridge NSString *)(CTFontCopyPostScriptName((__bridge CTFontRef)(font)));
}