Bold/Black ttf font for all languages supported by Cocos?

Hello.

I have a std::string = "йąq اخت וק क 通 だ" - it contains Cyrillic, European, Arabian, Hebrew, Hindi, Chinese and Japanese text.

If I show it as a Label::createWithSystemFont(...) then in started application it looks ok both on Windows7 and Android device.

If I show it as a Label::createWithTTF(..., "tahomabd.ttf" ) then in started application both on Windows7 and Android device - Chinese and Japanese text is not visible.
But when I use this Tahoma (bold) font with some Windows app - all text is shown properly.

So, is there some nice Bold/Black ttf font for all main languages supported by Cocos? I mean some Europeans + CJK languages? Thank you.

tahomabd.ttf.pdf (637.4 KB)

1 Like

Good question! Let me ask around.

1 Like

You can search on google fonts by language, for Chinese you can use noto (黑体) family, which should be nice in black and bold, but I’m not sure it’s compatible for Korean and Japanese

1 Like

My idea is to use one font for all Cocos supported languages. Windows provides such fonts.

But now I’m not sure about font file size:
Font having Cocos supported languages (European + Hindi, Chinese, Korean and Japanese) the ttf font file should be really bigger than 637KB (tahomabd.ttf file size). May be up to 21Mb.

I’ve checked my attached tahomabd.ttf with FontForge - seems it does not contain Asian languages.

Ok… At now my solution seems to be:

1.Read each (incoming) string in app; if it contains 3-bytes (or more) symbol - use the system font. For all texts; re-create the created texts.

2.In other case - use Label::createWithTTF(..., "tahomabd.ttf" )

0.If locale
LanguageType currentLanguageType = Application::getInstance()->getCurrentLanguage();
currentLanguageType is Asian - use the system font. But how to detect if it is Hindi?
(…I wonder, what part of people in India uses Hindi not English on their mobile devices?)

Thanks to those, who created getNextCharByteLengthAndCodePoint() function.

You should not worry about translating to Hindi or any other Indic languages. Most people prefer English on their phones, and the ones who don’t aren’t the audience you can monetize well from.

2 Likes

But if you really want to detect Hindi, you should check if the character lies in U+0900–U+097F unicode range.

See https://en.wikipedia.org/wiki/Devanagari_(Unicode_block)
https://en.wikipedia.org/wiki/Devanagari#Unicode

1 Like