TTF Rendering

TTF Rendering
0.0 0


HI there,

I am using CocosBuilder 3.0 and V2.1.2 of the HTML5 framework and I am having some difficulties in rendering TTF fonts.

I have the TTF file inside one of my project folders and I can apply it to the CCLabelTTF element with no problem and it renders ok inside CocosBuilder. However when I publish the files, it resorts to a default system font and to boot, its also very blurry.

I have noticed in the published files that the TTF file is not included in the generated resources file. Does it need to be? If so, what ‘type’ is the TTF resource?

What is interesting is that if I instantiate an instance of CCLabelTTF from directly inside my JS Controller, it works fine, it looks a little blurry, but at least its using the right font…

Am I missing something obvious here?

Thanks for your time…


Were you able to find a fix for this? The CCLabelTTF in my game is also loaded from cocosbuilder and the font that is rendered on an iPad3 is quite blurry in some places.


No, I ended up using CCLabelBMFont which worked well but I have run into issues with them on Safari now… They work in Firefox and Chrome though…


Just following up on this one again.

From some other reading I have done, I think the blurriness could be related to the font not being positioned exactly on a pixel. Is the label positioned somewhere between 2 pixels on the X or Y axis (or both)? That is something to look at. Also you might want to look at this page: - its written in objective C… I wonder if you could port it to Javascript and apply the new class as the controller of your CCLabelTTF in CocosBuilder… not sure if that would work, might be worth a try. I think it would be simple enough to convert to Javascript, assuming all those methods are there to override. Hopefully that fixes your bluriness.

The other reason I went for CCLabelBMFont was that I could control the line spacing a little better by editing the .fnt file and other properties of the font. I can’t see how you can control the line spacing when using CCLabelTTF.

I never solved why the TTF file was not being loaded correctly. It was early days in my CocosBuilder testing, but my experience since suggests that all is not OK with the loading of resources between the CocosBuilder 3.0 Alpha and the HTML5 Cocos2D libraries. And judging by the other forum posts that I have found, its comforting to know that others are experiencing similar inconsistencies with resource loading.


Hi…thanks for all the help. I have seen that link, but the problem is that when i use that, the CCControlButton Text that is loaded from CocosBuilder is out of place. Im still trying to look for a solution to the same. Also, the label is position properly at exact pixels.