Flipkart Search

Search This Blog

Thursday, April 8, 2010

Get list of all available fonts with family names in iPhone

Here is the piece of code to get list of all available fonts in your iPhone. This will print the list in gdb          

NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
            NSArray *fontNames;
            NSInteger indFamily, indFont;
            for (indFamily=0; indFamily<[familyNames count]; ++indFamily){
                NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
                fontNames = [[NSArray alloc] initWithArray:
                             [UIFont fontNamesForFamilyName:
                              [familyNames objectAtIndex:indFamily]]];
                for (indFont=0; indFont<[fontNames count]; ++indFont){
                    NSLog(@"Font name: %@", [fontNames objectAtIndex:indFont]);
                [fontNames release];
            [familyNames release];

No comments: