Open XenonSheng opened 6 days ago
the net was timeout or the resource did not exist
No network timeout. TTF files are downloaded successfully with (200 OK response). https://github.com/cocos/cocos-engine/blob/caf35a70c814561e27ebb8f372c06f6b51ee420a/cocos2d/core/asset-manager/font-loader.js#L36 Suspect it take longer time than 3 seconds. Haven't finished loaded the font, already go into the following line https://github.com/cocos/cocos-engine/blob/caf35a70c814561e27ebb8f372c06f6b51ee420a/cocos2d/core/asset-manager/font-loader.js#L109
2.4.13 did not support the reject(Promise)
我觉得 不关 reject promise 的事, 应该是可以运行的
ttf 文件 是下载成功了
可是我觉得在加载font的时候,需要更长的时间(需要大于3秒) 原因可能是华语font 比英文font 复杂
我怀疑它还没完成加载font就被强制timeout,导致font出现问题
我自己尝试了 把3秒换成 60秒, 再也没遇到这个问题
My tester has also found this bug when playing on slow internet. Even when the font is loaded it is not used properly. I would love to be able to change _timeout
externally, without building the engine
我觉得 不关 reject promise 的事, 应该是可以运行的
ttf 文件 是下载成功了
可是我觉得在加载font的时候,需要更长的时间(需要大于3秒) 原因可能是华语font 比英文font 复杂
我怀疑它还没完成加载font就被强制timeout,导致font出现问题
我自己尝试了 把3秒换成 60秒, 再也没遇到这个问题
加了promise也是可以运行的,但是不支持异步,会直接执行后面的代码,而异步的还在执行中,导致问题
你可以尝试不使用then函数,应该会正常
Cocos Creator version
2.4.13
System information
Windows 10, Android, IOS browsers (Web Mobile)
Issue description
Sometimes might get this error "Download Font [ XXX_LABEL] failed, using Arial or system default font instead". Mostly happens on first time launch the website.
Found the solution that can solve this problem by increasing the _timeout from font_loader.js. After updated _timeout from 3s to 60s, have tested on windows 10, android, and ios devices, so far so good. Suspect that require more time to load the font.
Recommend to make the timeout variable as global variable. So we can adjust ourselves based on our needs.
Hope someone can be updated for next v2 release. Thankss
Relevant error log output
Download Font [ XXX_LABEL] failed, using Arial or system default font instead
Steps to reproduce
Get any ttf files with chinese fonts.
Minimal reproduction project
No response