Joon. P Joon. P - 8 days ago 6
iOS Question

Only one custom font being recognized at item 0 in info.plist (xcode iOS)

I imported three fonts

checked that it all works fine until I add second custom font and so on.




If I set up my info.plist in this order (item 0 = KorUB.ttf), only KorUB.ttf is recognized :
enter image description here

UIFont *fontOne = [UIFont fontWithName:@"KorUM" size:10.0f] // not works
UIFont *fontTwo = [UIFont fontWithName:@"KorUB" size:10.0f] // works





If I change around the order (item 0 = KorUM.ttf) only KorUB.ttf is recognized :
enter image description here

UIFont *fontOne = [UIFont fontWithName:@"KorUM" size:10.0f] // works
UIFont *fontTwo = [UIFont fontWithName:@"KorUB" size:10.0f] // not works


What is this? bug? Does anyone know how to solve this?

Answer

It installs font, it should not be the case, try to list all Fonts using the code below

-(void)listFonts{

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

}

In your case, as per you are using the font like

UIFont *fontOne = [UIFont fontWithName:@"KorUM" size:10.0f]; 
UIFont *fontTwo = [UIFont fontWithName:@"KorUB" size:10.0f]; 

might not work, because it is not necessary that the fontWithName should be same as the name of font ttf file name, it can be different, see the list of fonts and use the name listed in the list, it should work.

Cheers.