Hi all. I am making a cocos2d game and I am wondering how to do this in cocos2d. In my game I want all numbers(0-9) be drawn using a custom bitmap. All other text could be drawn use system fonts. In other words I want to tweak some of the glyphs, to make the numbers looks more impressive. Does cocos2d-x support this? Thanks!
hello, in cocos2d-x, i think “CCSprite* spriteWithFile(const char *pszFileName, CCRect rect);” could meet your demand.if you want more information, please look into the test codes.
Sure I could use CCSprite. But that need some extra code. It would be a lot easier if the font support it directly.
do you mean that you still want to use the system fonts, but only replace some numbers with your own?
After some research I found CCLabelBMFont may be the answer. I will try to mix it with CCLabelTTF.
Yes. If there are no Chinese characters I could just use CCLabelBMFont, but that is not an option…
RongHong Huang wrote:
ok, the engine support custom fonts now, you could refer to FontTest.
i don’t use the custom fonts before, but i think it will resolve your problem.
I think custom fonts only allow me to load a custom ttf file. But I am not going to ship the game with a big ttf font file with all Chinese characters… I have to use system font for Chinese.