1, first we need to download and install the Bmfont tool, as follows: http://download.csdn.net/detail/chenqiai0/8899353 (there are detailed the use of the document, if the use of what do not understand please leave a message). 2 , after installation, open Bmfont, the interface is as follows, the list on the right is the font library
3. Create a TXT file and enter the text you use ( Note: Use Utf-8 when saving, otherwise the software will not be recognized )
4, the next operation please download the above resources, and then follow the steps in the PDF, you can certainly achieve the export of fnt files.
Note: It is important to note that the path does not contain Chinese when the file is exported, which may be bmfont for other reasons.
After exporting the file, you will find a fnt file and a PNG file in the save path (this is similar to the plist file saving jigsaw information) and copy them to fonts under the resources directory of the COCOS2D-X project:
Then create a new COCOS2DX project and add the following code:
<span style= "Font-weight:normal;" >cclabelbmfont *labelbmfont = Cclabelbmfont::create ("Independent Developer ER", "fonts\\a.fnt"); Labelbmfont->setposition (CCP ( VISIBLESIZE.WIDTH/2, visiblesize.height-100)); AddChild (labelbmfont,1);</span>
Reference Blog:
http://blog.csdn.net/chenqiai0/article/details/46866745
http://blog.csdn.net/keshuiyun/article/details/9960589
http://blog.csdn.net/aa4790139/article/details/8113197
http://blog.csdn.net/keshuiyun/article/details/9960667
http://book.51cto.com/art/201504/473605.htm (Bmfont export parameter for details, please refer to this blog)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"Independent Developer ER cocos2d-x combat 008" Bmfont generate bitmap Font tool and COCOS2DX use load Fnt file