Font Problem in Cocos Creator 2.1.1

Hello!

I’m trying to upgrade my app to Cocos Creator 2.1.1.

One major issue is that the fonts (TTF) don’t seem to load anymore.

The related error message seems to be:

Simulator: JS: [WARN]: Download Font [ "Envy Code R_LABEL" ] failed, using Arial or system default font instead

(Find the entire log below.)

As you can see in the picture, I started a fresh ‘Hello World’ example project from CC 2.1.1, and I simply tried to change the font. I dragged the “Envy Code R.ttf” into the editor. It DOES look correct in the preview, but during runtime the error message appears and the font falls back to Arial.

Here is the project as a .zip file:

Any hints would be appreciated, thanks alot!
Fabian

Simulator: ------------------------------------------------
Simulator: JS: No need to specify the "type" of "cc.EditBox._N$fontColor" because cc.Color is a child class of ValueType. Just set the default value to 'new cc.Color()' and it will be handled properly. cc.EditBox _N$fontColor cc.Color
Simulator: JS: No need to specify the "type" of "cc.EditBox._N$placeholderFontColor" because cc.Color is a child class of ValueType. Just set the default value to 'new cc.Color()' and it will be handled properly. cc.EditBox _N$placeholderFontColor cc.Color
Simulator: iShow!
Simulator: glGetIntegerv: pname: 0x8b4c
Simulator: JS: [WARN]: Failed to define shader 061403a4fee41e99c7fbd0d70d603c430d3f85dbed5674580d6326e7: already exists.
Simulator: JS: Cocos Creator v2.1.1
Simulator: libpng warning: iCCP: known incorrect sRGB profile
Simulator: JS: [WARN]: Download Font [ "Envy Code R_LABEL" ] failed, using Arial or system default font instead

(Oddly, this problem persists upon freshly installing Cocos Creator 2.1.1 and creating a new, empty “Hello World” project.)

My hunch is that the “_LABEL” is added to the font’s name for downloading, which is why the download fails. But I’d love to get some feedback on this…

I download your project and rename the font to ‘Envy Code R_LABEL’, but I can not find any warning about download font failed at 2.1.1 or 2.1.2
image

you can check if that is your network problem, because the _timeout property in ‘font-loader.js’ is 3000.
if your download time is large than 3s, your will see this warning and the engine will give up the download and use a default font.

1 Like

Hello!

I did some further experimentation – the problem for me exists only in Simulator Preview, not in Browser Preview:

Renaming the font (+ “_LABEL”) and also duplicating it (with a second version +"_LABEL") doesn’t help either…

I did take a look at “font-loader.js”, but _timeout is set to 60000 already.

Any ideas on this would be much appreciated. Thanks alot!

@Big_Bear if you could take a second look, that would be perfect. Thanks!

(Were you able to reproduce the problem?)

I did not miss that issue on Simulator Preview at 2.1.2

1 Like

I’m sorry to ask again – but the problem persists, and it currrently breaks my app.

I also tried to completely remove CC, to no success.

Thanks, I’ll give it a try immediately. :slight_smile:

I got this issue too, font can’t load on window simulator and android, only available on web. Please fix it.

That happened with me too on web

I found the solution. The font name made somethings wrong in Android / Mac simulator.
I’m using this font which can download here: https://www.dafont.com/riffic.font
Font name:

  • “RifficFree-Bold”: work well on Mac simulator / Android.
  • “Riffic”, “qwe”,… and others: not working.

So try change the font name or just using the default name, maybe your problems can solved.
It’s not occur with all fonts.

Hope this help and hope cc team will fix it soon.

Thanks,

Hey guys!

I solved it another way. It seems to be related to this issue:

On macos, I was able to solve the “font not showing up in simulator” issue by uninstalling the font from my system (via Font Book), yet leaving the .ttf file in my project folder.

It’s a horrible workaround (especially if you plan to use the same font in your games’ marketing material as in the game), but it works for now. Phew.

Greetings!
Fabian

1 Like