Bitmap font generator bitmap font tool for Cocos2d-x Study Notes

Source: Internet
Author: User

The ". fnt" file was used earlier, but the ". fnt" file was not described...

Today, we will use this very useful Bitmap Processing tool to answer the above questions...

1,: http://www.angelcode.com/products/bmfont/

2, create a TXT file, and then enter the text you use, save as UTF-8 encoding txt, this software may not support other encoding import.

Above is my input content

3. Understand the bitmap font Generator interface:

This is what we open by default. The list on the right is my font library. Different fonts are separated by separate font blocks (NOTE: For symbols and other inputs, check the First Latin + Latin supplement in the right list)

① Edit-> select char from file: select the newly created bitmap.txt file. After the file is imported, you will find that the characters in the content are selected.

② Options-> font setting: font can be selected by yourself. Select Unicode by default in charset.

③ Options-> export options:

Note that this is cocos2dx. If other engines are used, follow the corresponding engine settings.

④ Options-> Save bitmap font ..

After entering the exported file name bitmap, the file named ".fnt" will find that the exported file contains another bitmap.png file, which is the image resource.

4. code usage:

Ccsize S = ccdirector: shareddirector ()-> getwinsize (); // Note: Enter the text in the Image Library.

Cclabelbmfont * label = cclabelbmfont: Create ("Oh! I use bitmap succeed! "," Fonts/bitmap. fnt ");

Ccmenuitemlabel * Item = ccmenuitemlabel: Create (Label, this, menu_selector (menutestlayer: menucallbackconfig ));

Item-> setposition (CCP (S. width/2, S. Height/2 ));

Layer-> addchild (item );

5. Running effect:

6. Chinese Font Input

First set the font to Chinese options-> font setting: font you can select (Chinese) by yourself. When saving the character set, select the merunicode character.

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.