Hi,
does some one know how to use italic and bold fonts?
this seems not to work :
Label * myLabel = [Label labelWithString:@"Bold and italic text" fontName:@"Helvetica Bold Italic" fontSize:40];
any suggestions?
A fast, easy to use, free, and community supported 2D game engine
Hi,
does some one know how to use italic and bold fonts?
this seems not to work :
Label * myLabel = [Label labelWithString:@"Bold and italic text" fontName:@"Helvetica Bold Italic" fontSize:40];
any suggestions?
There is no font named "Helvetica Bold Italic" on iPhone. Try "Helvetica-BoldOblique".
Search google for iPhone supported fonts, or use newest cocos2d feature like ttf support..
Solution:
Use this to view all available Fonts for a family :
NSLog(@"---------------------------------");
NSLog(@"Font Names available for Helvetica:");
NSLog(@"---------------------------------");
NSArray * fontNames = [UIFont fontNamesForFamilyName:@"Helvetica"];
for (NSString * fontName in fontNames)
{
NSLog(@"Font Name : %@", fontName);
}
NSLog(@"---------------------------------");
Output:
---------------------------------
Font Names available for Helvetica:
---------------------------------
Font Name : Helvetica-Oblique
Font Name : Helvetica-BoldOblique
Font Name : Helvetica
Font Name : Helvetica-Bold
---------------------------------
Now you will see that "Helvetica Italic" is not supported because its called "Helvetica-Obligue"
so try this instead:
Label * myLabel = [Label labelWithString:@"Bold and italic text" fontName:@"Helvetica-BoldOblique" fontSize:40];
cheers,
Sendel.
You must log in to post.