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!