Cocos2d Font Extensions Issues
Good afternoon, sports!
I have a fast doubt. I'm using COCOS2D and i need to know if i can use other extension type of font other than ".fnt". Because i used a few and didn't have any luck.
I'm using this piece of code to make a "credits" scene:
CCBitmapFontAtlas* l_026 = [CCBitmapFontAtlas bitmapFontAtlasWithString:@"Look for our apps in the AppStore" fntFile:@"fission.fnt"];
开发者_StackOverflow
If it isn't which can i use? And it is do you know any font converter to change "normal fonts" to ".fnt"
Thanks!
The best font program in my opinion is: Glyph Designer. It is inexpensive and very easy to make great looking fonts.
I use CCLabelBMFont but I'm pretty sure it is basically the same thing.
If you have some cash to spend you can use Glyph Designer as suggested by Aaron. But you can also use a free Java tool named Hiero. You might have to do some tweaking to get the result you want though.
The tool will output 2 files: one .png
and another .fnt
. Add these files into your Xcode project and use it using simple lines like below:
CCLabelBMFont *some_label = [CCLabelBMFont labelWithString:@"Your Text" fntFile:@"fontfile.fnt"];
Do note though that the size of the font from each pair of fnt/png files is fixed, so you have to create multiple pairs if you want to have different font sizes. Also, you need separate pair for Retina and non-Retina display modes.
精彩评论