0
votes

I am currently using the font Yoxall in my app, and have .ttf files for "Regular", "Bold", and "Italic". I am currently using the coke [UIFont fontWithName:@"Yoxall" size:20.0f] to set the font as the regular Yoxall, using the YOXALL__.ttf file in my supporting files. I would also like to use italic Yoxall elsewhere in my app, but I obviously cannot call the same method, as "Yoxall" refers to both these files.

What code would I use to distinguish between the regular, bold, and italic styles of this font?

2
Add all required font files in your projects and mention name of those file in .plist file - kb920
keyur, is there some sort of tutorial online for what you're describing? I don't know how doing this would help me at present. Thanks - Isaac A
if you have added all files in your projects then it will giving all fonts name in nslog from there you can search appropriate name font which you can use in [UIFont fontWithName:@"Yoxall" size:20.0f] this method - kb920
This works. Thank you :) - Isaac A

2 Answers

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

This function will give all fonts name.

0
votes

Use +[UIFont familyNames] to list of all font family names known to the system, you can use +[UIFont fontNamesForFamilyName:] to list all of the font names known to the system.

Example code:

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

in output you can get font name. hope it's help