Projects > cpp > Issues > Bug #4503

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Quality of font rendering

Bug #4503 [Closed]
Zombie 2014-03-21 17:28 . Updated about 2 years ago

The quality of font rendering is not very good. Text is blurry and unsharp.

I added two screenshots. One does show the cocos2d-x V3 rendering of LabelTTF, LabelBMFont, and Label.
The other does show the rendering in the Mail app of osx.

The used font is Arial 14.

Screen Shot 2014-03-21 at 18.19.04.png (43.3 kB) Zombie, 2014-03-21 17:28

Zombie 2014-03-21 17:29

Small mistake: I added only one screenshot showing all the labels.

ricardo 2014-03-23 19:06

Subpixeling issue ?
If so, it shouldn't be complicated to fix.

I think if we remove the floating part of the x,y,z in transform and also in the position it should work.
By that I mean, fixing CCLabel.cpp # onDraw.

@minggo, can we fix this for 3.0?
If not, what about v3.1 ?

Zombie 2014-03-24 10:58

I tried some stuff to ensure there is nothing drawn on sub pixels, but with no luck.

It is not easy to understand what is happening in the Label class.
The CCLabel code is quite complicated as it there is code for LabelTTF, LabelBMFont and Label all in one place. E.g. a Label does nervier call its onDraw or updateQuads methods.

Why is Label using the _textSprite to render? I thought Label is like a LabelBMFont, but with the difference that the texture is generated at runtime.

I think Label should be cleaned up by moving stuff in derived classes. It is very hard to understand if half of the code is never used depending on how the label was created.

Zombie 2014-03-24 11:40

The path to the ttf file was wrong. After fixing that onDraw is called. There is a warning about different behaviour in the header of CCLabel. I think this is not enough and the fallback when a rtf is missing is quite dangerous.

ricardo 2014-03-24 23:57

the Label code needs to be cleaned up

ricardo 2014-03-24 23:57
  • Priority changed from Low to Normal
  • Target version set to v3.1
Zombie 2014-03-25 14:00

I found the real source of the unsharp labels in my test program.

  1. You have to set the projection of the director to Director::Projection::_2D
  2. Do not set any design resolution or content scale factor.

Would be interesting to know why 2D projection is required. Thats ok for out current project, but also in 3D you want sharp labels

Zombie 2014-03-25 16:36

If a Label has CENTER alignment, the characters are sometimes drawn on sub pixels even with 2D projection and no content scale factor.

I send a small gitHub pull request, fixing that.

zhangxm 2014-04-05 02:46
  • Assignee set to WenHai
zhangxm 2014-05-20 06:51
  • Target version changed from v3.1 to v3.2
glezx 2014-05-27 08:24

Is there a workaround for this defect, other than <ins>not</ins> setting the design size or avoiding the Label components?

zhangxm 2014-06-25 03:32
  • Target version changed from v3.2 to Candidate 2014-10-08 02:59

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to

Atom PDF

Start date:2014-03-21
Due date:
% Done:


Target version:Candidate

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.