I created a method that reads descriptions of the fonts in the fontsArray of a certain family and returns appropriate font.
- (UIFont*) getFontWithFamilyName:(NSString*)familyName bold:(Boolean)bold italic:(Boolean)italic size:(uint)size {
NSArray *fonts = [UIFont fontNamesForFamilyName:familyName];
for (NSString *fname in fonts) {
UIFont *font = [UIFont fontWithName:fname size:size];
Boolean isBold = [[font description] rangeOfString:@"bold"].location != NSNotFound;
Boolean isItalic = [[font description] rangeOfString:@"italic"].location != NSNotFound;
if (isBold == bold && isItalic == italic) {
return font;
}
}
//-- font was not found, provide system font bold or normal
if (bold) {
return [UIFont boldSystemFontOfSize:size];
} else {
return [UIFont systemFontOfSize:size];
}
}