5

I'm looking for an official list of available Fonts on iOS 4.2 since Apple included more fonts with the 4.2 update.

Unfortunately, I can't seem to find anything in the main documentation, nor on Apple's developer site; but I faintly remember that somewhere I saw an "official", that is, a list made by Apple of all fonts available on iOS.

If someone could point me to a piece of documentation, that would be nice. :)

Thanks in advance!

Update:

Found an app called "Fonts" on the App Store (free). It simply displays all fonts on the device.

Community
  • 1
  • 1
BastiBen
  • 19,679
  • 11
  • 56
  • 86
  • 2
    possible duplicate of [What fonts do iPhone applications support?](http://stackoverflow.com/questions/249251/what-fonts-do-iphone-applications-support) – Brad Larson Nov 19 '10 at 15:12
  • See "[What fonts do iPhone applications support ?](https://stackoverflow.com/questions/249251/what-fonts-do-iphone-applications-support)" – Benoît Nov 19 '10 at 09:51

1 Answers1

2

You can check the available font for your device (iPhone or iPad) using this method

- (void)getAllFonts{
   NSArray *fontFamilies =[UIFont familyNames];

   for(int i =0; i <[fontFamilies count]; i++){
       NSString *fontFamily =[fontFamilies objectAtIndex:i];
       NSArray *fontNames =[UIFont fontNamesForFamilyName:[fontFamilies objectAtIndex:i]];
       NSLog(@"%@: %@", fontFamily, fontNames);
   }
}

Copy/paste this on a class and use [self getAllFonts];

The list should be displayed on your logs

EDIT: If you wanted to see what it looks like, how about we use a table view

STEP1: Add this to your header

@interface FontViewController (){
    NSArray* fontFamilies;
}

STEP2: On your interface file (.m), populate your array on viewDidLoad.

-(void)viewDidLoad{
    fontFamilies = [UIFont familyNames];
}

STEP3: Finally, add this to you cellForRowAtIndexPath method

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    // The Magic :)    
    cell.textLabel.text = [fontFamilies objectAtIndex:indexPath.row];
    cell.textLabel.font = [UIFont fontWithName:[fontFamilies objectAtIndex:indexPath.row] size:12];

    return cell;
}

PS: Make sure you got the delegate and datasource connected. Your tableView Cell property on your storyboard (or xib) should be "Cell", And make sure that:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return fontFamilies.count;
}

For more info on table views, check the apple documentation here

or see appCoda's Table View tutorial here

Laszlo
  • 2,803
  • 2
  • 28
  • 33
aalesano
  • 357
  • 2
  • 13