I’m trying to get a 32 point font, based on a font atlas (created with Glyph Editor), to display in my game. The call to the font is made like this:
CCLabelBMFont *scoreSprite = [CCLabelBMFont labelWithString:[NSString stringWithFormat:@"-"] fntFile:@"press_start_2p_lg.fnt"];
When that label is displayed in game, however, the font displays completely incorrectly: it’s basically only showing parts of some of the characters, from what I can tell. I have other atlases that are smaller in size (8-16 point). If I replace the offending fntFile declaration with one of them, it works fine.
I also have other labels elsewhere in the program that work, unless I try to give them the “press_start_2p_lg.fnt” font file. I’ve tried recreating the atlas in both Glyph Editor AND Hiero, and I’ve even changed the font within the atlas just to make sure the whole thing was recreated, all with no luck. Is there something I’m missing?
If changes don’t appear on Simulator or the device, try deleting the app from Simulator or Device first. Also try a Clean build to make sure everything is included in the app.
Other things to watch out for is if you’re trying to use non-ASCII characters. Cocos2D allows 2048 characters by default, which is not enough for Unicode characters.
You might also want to open the .fnt file in a text editor and see if you can find any obvious issues, such as referencing the wrong .png file.
I’m also wondering why you’re using NSString stringWithFormat. The above line of code is exactly the same as this one: