UILabel with custom font displays *wrong* custom font

Posted by winsmith on Stack Overflow See other posts from Stack Overflow or by winsmith
Published on 2011-01-07T06:11:54Z Indexed on 2011/01/07 12:53 UTC
Read the original article Hit count: 179

Filed under:
|
|
|

I'm using this method to embed custom fonts in my iPhone app.

The embedding works: When I run the following code, the fonts are listed. (Currently, I'm embedding all family members of Myriad Pro in OTF format)

for( NSString *familyName in [UIFont familyNames] ){
    for( NSString *fntName in [UIFont fontNamesForFamilyName:familyName] ){
        NSLog(@"%@", fntName);
}}

When I try to set the font of a label to MyriadPro or MyriadPro-Bold, this works just as expected. However, when I set the font to MyriadPro-BoldCond, the label is still set in MyriadPro-Bold instead of the condensed version. (The font names are correct, I checked.) My Code:

[recommendationLabel setFont:[UIFont fontWithName:@"MyriadPro-BoldCond" size:140]];
recommendationLabel.adjustsFontSizeToFitWidth = YES;

What's the deal?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c