Font issue with Cocos Creator (1.8 to 2.0)

Hi everybody,

To make it simple, I have the same issue as this guy LINK, and I posted an answer but a message told me that the topic will be closed. So I recreate one.

When test my game on Chrome/Firefox/Mobile, I notice there is a difference in the font position, only a few pixels, but enough to be ugly on my UI. Here is an example below. I laready tried the solutions in the other topic but nothing did it for me.

Thanks in advance

Still looking for an answer

I think, these are browser-related issues.
Different browsers handle fonts rendering differently.

So, I would suggest either

  • create texts as images
  • use a bitmap font

Thanks for your answer. I already tested bitmpas fonts dans they are ugly as hell on high res screens. I hoped i could use realt fonts in my game.

Another problem is the localization, if I need to translate my game, i’ll have huge sheets to cover every languauge and I can’t afford to have too large textures. And I don’t really want to load textures for each language.

Any other ideas to fix the problem?

I suppose your project is web based.
If so, you can detect user agent and apply fixes according to user agent types.

eg, if (agent == firefox) node.y -= 4;

this is not actual code, just the idea to work on.

Actually it’s for facebook instant games. I already tried that but when i’m on mobile, it returns Chrome on android, and Unknown on iPhone… an this is not the same offset in chrome mobile and chrome PC… This is a nightmare.

I am not sure whether this will help you or not,
but try setting vertical Align of Label to Top and adjust the position in editor as you want, and then try running on browsers

It changes somthing, but it’s worse :rofl: The offset is even more important.

image

And this label was positioned properly in creator editor?

after setting vert align to top

Yup, I think so

image

image

Are they still different on moz and chrome after updating vertical alignment or they look same.

Also my last suggestion for you to try is to try with vertical align as bottom also

Y that was what my first screen was about.

And with bottom the offset is now negative in firefox.

image

I believe you will have different offsets with different TTF files.

I meant to ask, even after updating the vertical alignment , the label behave differently in moz and chrome?
Wasn’t your first screenshot is with vertical alignment = center.

My first answer to you was in firefox with top alignement

(Font issue with Cocos Creator (1.8 to 2.0))

Still looking for a fix

So no better solution than bitmap fonts?