Create a bitmap font using Glyph Designer

Source: Internet
Author: User

Create a bitmap font using Glyph designer

Turn http://book.2cto.com/201210/6610.html

IOS 5 cocos2d Game Development (2nd edition) will guide you through the development of compelling 2D games. The book shows how to use Cocos2d's powerful game engine to develop iphone and ipad games, as well as tile maps, virtual sticks, game center, and more.  The book ... Go to Dangdang to order now

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.

Create a bitmap font using Glyph Designer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.