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.