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
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
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.
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.
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.