Simulator error: Assertion failed:... function append, native build crash

Hi.

Maybe somewhat related to this topic:

I`m using a TTF font in my project and when I build a native macOS app, the app crash.
When I run the preview in Simulator I get the following error related to CCFontAtlas.cpp:

Assertion failed: (width <= _WIDTH && height <= _HEIGHT), function append, file /Users/nantas/jenkins/workspace/Creator_2D/cocos2d-x-lite/mac/cocos2d-x-lite/cocos/2d/CCFontAtlas.cpp, line 88.

I would like to point out I don’t have a user called ‘nantas’ on my system, not sure how is that supposed to be working.

When I run a preview in web browser or build a web app, it works.
If I remove the TTF font and use a system font, it is also solve the problem.
Is there any solution to this or I should just stop using TTF fonts all together?
If that so, what sort of fonts works best with Cocos Creator?

Using Cocos Creator 2.4.3 on macOS Catalina 10.15.7

Thanks.

Hi, can you provide a demo that reproduces the problem?

Weird, I am not able to reproduce the error message and crash in a new project, what is happening instead in the simulator the font does not load and I get only a warning:

libpng warning: iCCP: known incorrect sRGB profile

Here is a demo:
TTFTest.zip (1.2 MB)

Managed to solve both problems:

  1. Font not loading In simulator: Need to set the cache mode to Char and it is solve the problem.
  2. Assertion failed error: happening if the cache mode is set to Char and the font size is set to 270 or higher

Here is a demo that reproduce the problem:
TTFTest2.zip (1.2 MB)

The label size is too large, which exceeds the font atlas dimension (defaults to 1024). Please use a smaller font and scale it.

You can also edit CCTTFLabelAtlasCache.cpp and set font atlas size to 2048

#define FTT_TEXTURE_SIZE 2048

I can not because then the font is pixelated and blurred. But thanks.