Font issue with Cocos Creator (1.8 to 2.0)

Font issue with Cocos Creator (1.8 to 2.0)
0

#1

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

Example


#2

Still looking for an answer


#3

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

#4

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?


#5

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.


#6

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.


#7

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


#8

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

image


#9

And this label was positioned properly in creator editor?


#10

after setting vert align to top


#11

Yup, I think so

image

image


#12

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


#13

Y that was what my first screen was about.

And with bottom the offset is now negative in firefox.

image


#14

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.


#15

My first answer to you was in firefox with top alignement

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


#16

Still looking for a fix


#17

So no better solution than bitmap fonts?