I've had hit-or-miss success with using custom fonts in an iOS app.
I follow these steps:
- Drag in the font into my project and copy into the project
- Make sure the font is included in the Build Phases
- Add the font name (including the extension) into the app's plist file. I confirmed that I am using the postscript name: SourceSansPro-ExtraLight.ttf
Try to use the font
self.daysLeftLabel.font = [UIFont fontWithName:@"SourceSansPro-ExtraLight" size:14];
However, only the generic system font is used.
If I run this code sample in my code:
for (NSString* family in [UIFont familyNames])
{
NSLog(@"%@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family])
{
NSLog(@" %@", name);
}
}
The Source Sans Pro font family isn't included in this, so something isn't working.
The thing is, I followed the exact same sequence for other custom TTF fonts and they work as expected. As far as I can tell, I am doing everything right -- including the often-missed postscript name in the plist file along with the extension.
So, I'm beginning to wonder if some TTF fonts are compatible with iOS and some others aren't. Is this the case?