I have successfully added a custom font to my project and it works just fine by doing this line of code amongst other things:
[sideScoreLabel setFont:[UIFont fontWithName:@"Caveman" size:34]];
However I want this custom font to be bolded. I have researched this and everyone seems to be saying to add "-Bold" at the end of the font name or "-BoldMT" making it appear like the following:
[sideScoreLabel setFont:[UIFont fontWithName:@"Caveman-Bold" size:34]];
When I run my project it does not seem to work. Does anyone know what I am doing wrong? Perhaps the font I am using does not work with Bolding?
Thank you!
I have successfully added a custom font to my project and it works just fine by doing this line of code amongst other things:
Dude you added a CUSTOM FONT to your iOS bundle.
If you want a bold version of that font you need to provide one the system wont do it for you.
You are on the right track when you mention the font not being able to be bolded. You can verify this with this bit of code that will encho out to console all available fonts, then you can look for your font in there.
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With