After the 1th edition of the book, Www.71squared.com released a tool to replace Hiero: Glyphdesigner. Although the tool is chargeable, it is worth the money.
You can download the trial version of Glyph designer at http://glyphdesigner.71squared.com. If you are already familiar with Hiero, you will find that the two functions are very similar, but Glyph designer's user interface is much simpler and there are plenty of places to explore. Mike Daley in a set of cocos2d podcasts (which can be found in http://cocos2dpodcast.wordpress.com), Glyph Designer also adds a new feature, Allows font design to be shared with other users of the tool.
Figure 4-7 shows the glyph Designer. The process of creating a bitmap font is relatively easy, and trying to adjust the various knobs, buttons, and colors in the glyph designer does not hurt. The areas that can be edited are indicated below.
You can see a list of TrueType fonts on the left side of the diagram, and if not enough, you can load any TTF file using the Load font icon. Below the list, you can use the slider bar to change the font size and apply bold, italic, and other font styles.
Tips:
Creating a bitmap font that supports the Retina screen is simple. Create fonts normally and export them, which will be non-Retina screen fonts or SD fonts. Then, increase the font size by 1 time times in Glyph designer. For example, move the slider from font size 30 to font size 60. Then, using the same file name, but with the HD suffix, re-export the font. Now you have both the normal/sd and the retina screen/hd size font.
If you run a game on a device with a Retina screen, and support for the Retina screen is enabled, COCOS2D will automatically recognize and use fonts with the HD suffix.
In the center of the screen, you can see that the resulting texture book is used for the current font settings. Note that when you modify font settings, the size of the map book and the Order of the Strokes change frequently. You can select a stroke and view its information below glyph info in the right pane.
In the lower right pane, you can modify the settings of the texture book, but in most cases there is no need to modify it. Glyph Designer ensures that the texture atlas is always large enough to contain all the strokes in a single texture.
Glyph fill provides settings to modify the color and fill of strokes, including gradient settings. There are also two options: Glyph outline and Glyph Shadow. With glyph outline You can modify the thin black line next to each stroke and use glyph shadow to create a 3D appearance for the font.
At the bottom of the right pane is the included Glyphs section. In this section, you can choose which predefined strokes are included in the texture book. If you're pretty sure you don't need some characters, you can also enter your own list of characters to reduce the size of the texture. For example, in a scoring string, only numbers and very few characters are required, so it is particularly helpful to do so.
When you're satisfied with the bitmap font, you can save the entire project so that you can restore the original settings. In order to save fonts in the format available in ocos2d, you need to use file | Export saves it in. FNT (cocos2d Text) format. You can then add fnt and PNG files created with Glyph Designer in the Xcode project and use fnt files in the Cclabelbmfont class.
Warning:
If you try to use Cclabelbmfont to display characters that are not available in the. fnt file, these characters will be skipped and will not be displayed. For example, if you use a statement [Label setstring:@ "Hello, world!"], but the bitmap font contains only lowercase letters, excluding punctuation characters, the string "Ello Orld" is displayed.