Sunday, October 9, 2022
HomeGame DevelopmentThe right way to cache RichText font in Cocos Creator 3.5.0 -...

The right way to cache RichText font in Cocos Creator 3.5.0 – Cocos Creator


I attempted to make use of RichText part and use my very own font (not system font). The fonts are OK and appropriately loaded once I run it on browser for debugging.

However the issue is that once I run it on the android machine, the font isn’t loaded and it use Arial as a substitute.

Is there any option to resolve it? I do not forget that now we have Cache in Label part, however I couldn’t discovered it on RichText.

I’m making a sport for Android machine utilizing Cocos Creator 3.5.0


Examine if the font-family and font-name of ttf fonts are the identical.

The Font-Household property isn’t out there on the RichText in 3.5.0

Are you able to present the font you might be utilizing now?

It’s exhibiting on my screenshot above.
Font is Silkscreen-Common.ttf

Are you able to give me your font for check?

you’ll be able to obtain it right here: https://fonts.google.com/obtain?household=Silkscreen

Anyway, it occur on all fonts that I attempted. Even Calibri…


The font-family and font-name usually are not the identical. You need to use this software to alter the font:FontCreator for Home windows – the most well-liked font editor

I’ve tried it:

Nonetheless no luck, the font nonetheless not loaded.

right here is the font

i’ve check with the font you give, all works effectively, right here is my demo:
57256.zip (38.9 KB)
and right here is screenshot in my telephone, my telephone is huaweiP30Pro

it’s RichText, not Label part, proper?

i don’t know why it’s nonetheless not engaged on mine:

It work if i take advantage of Label, however it doesn’t work in RichText

I attempted to log the Font and FontFamily of the RichText:

D/jswrapper: JS: Popup_Manager::show_credits() Font GUI =  property/essential/native/2a/2a613d4e-f148-4a8b-9cc7-e07a5ff8f58f/Silkscreen.ttf
2022-10-01 02:10:06.982 13860-13903/com.juarasatu.muscleman
D/jswrapper: JS: Popup_Manager::show_credits() FontFamily GUI =  Arial

By default even after I exploit the font file it all the time have ARIAL because the Font-Household. And that i although if I manually change it to Silkscreen it’s going to work. However seems it doesn’t.

RichText.FontFamily = "Silkcreen";

Are you able to make a demo of this a part of your venture and ship it to me?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments