Cocos2d-x elementary school (6)-> bitmap font generator bitmap font Tool

Source: Internet
Author: User

Reprinted! Please indicate the source when reprint: http://blog.csdn.net/aa4790139/article/details/8113197

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 enter the text you need

This is the content I entered (Note: There is a mobile app that needs to use UTF-8. This software may not support encoding)

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 ctor: shareddire()-> getwinsize (); // note: 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:

Q: I don't know why resources cannot be loaded due to Chinese input .... I have not found a solution for the moment. If a friend has made the solution, please let me know, and then finish adding this... thank you!


If the story is incorrect or incorrect, I hope you can point it out!

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.