@ddabrahim posted a new topic, subject "Simulator error: Assertion failed:... function append, native build crash". It read:

   Hi.
    
    Maybe somewhat related to this topic:  
    https://discuss.cocos2d-x.org/t/ttf-font-is-pixelated/51604
    
    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.
    
    font-error3594×399 99.1 KB
    
    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.

@yufang.wu replied

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

Then @ddabrahim said

    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)

After which, @ddabrahim added

    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)

Then @PatriceJiang said

    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
    [code] 
        #define FTT_TEXTURE_SIZE 2048
        
    [/code]

Then @ddabrahim said

    PatriceJiang:
    
    > Please use a smaller font and scale it.
    
    I can not because then the font is pixelated and blurred. But thanks.


{'source': 'discourse', 'url': 'https://discuss.cocos2d-x.org/t/simulator-error-assertion-failed-function-append-native-build-crash/51698', 'title': 'Simulator error: Assertion failed:... function append, native build crash', 'views': 348, 'has_accepted_answer': False, 'word_count': 382, 'like_count': 0, 'reply_count': 3, 'participant_count': 3, 'posts': 6, 'tags': '', 'author': '@ddabrahim', 'participants': '@ddabrahim, @yufang.wu, @PatriceJiang', 'image_url': ['https://discuss.cocos2d-x.org/uploads/default/optimized/3X/9/c/9c38cd1ab3950c3cb1e874a879329c9a061dd5b8_2_1024x113.png'], 'created_at': '2020-10-11T08:28:48.507Z', 'last_posted_at': '2020-10-13T05:08:28.061Z'}