learn-gdscript icon indicating copy to clipboard operation
learn-gdscript copied to clipboard

Add CJK font

Open NathanLovato opened this issue 3 years ago • 10 comments

People are translating the app to Chinese and Japanese. We should include fonts for those languages in the app for testing purposes.

EDIT: PR https://github.com/GDQuest/learn-gdscript/pull/688 attempted to add those. However, these fonts are heavy and we'd like not to make the initial download larger for every user., but rather do it on demand.

Fonts should be downloaded at runtime and cached when users switch to Chinese or another CJK language. This means they also need to be swapped at runtime, using Godot's theming API.

NathanLovato avatar Apr 20 '22 06:04 NathanLovato

Hi Nathan. Just for understanding, purpose of this issue is "just" to add some addtional fonts for support this languages. Right? So for example put a font from here: https://fontmeme.com/fonts/cjk-fonts-collection/ under the folder "ui/theme/fonts"

Wolfy7 avatar Oct 02 '22 19:10 Wolfy7

Yes, this also involves updating many font resources with the appropriate font files/fallbacks. See res://ui/theme/fonts. Ideally I'd like a CJK font that's not only good-looking, clearly readable, but also fairly lightweight if possible. A great candidate is Noto Sans: https://fonts.google.com/noto

NathanLovato avatar Oct 03 '22 06:10 NathanLovato

And as far as languages are concerned, we will need at least Japanese, simplified Chinese, perhaps Korean. We currently can't support arabic, at least iirc right-to-left writing isn't supported in Godot 3, so it's something we'll have to add when porting to Godot 4.

NathanLovato avatar Oct 03 '22 06:10 NathanLovato

Hi. Thanks for make it clearer.

I had then just some addtional quqstions:

  • Yes, the Noto Sans looks good therfore (i also had seen this). There is also Noto Serif.
    • So these Fonts could be added:
      • Korean: https://fonts.google.com/noto/specimen/Noto+Sans+KR?noto.lang=ko_Kore&noto.continent=Asia&noto.script=Kore
      • Japanese: https://fonts.google.com/noto/specimen/Noto+Sans+JP?noto.query=Japanese&noto.lang=ja_Jpan&noto.script=Jpan
      • For Chinese there are two, one for Simplified Chinese and one for Traditional Chinese
  • Should there are also new resources like font_documentation_bold.tres just then for the corresponding language for exaample font_documentation_korean.tres
  • If i undestand the Documentation right:

DynamicFont also supports defining one or more fallback fonts, which will be used when displaying a character not supported by the main font.

  • We should add then these new fonts as "Fallback" in all font resources

If i understand everything correct you can assigne this to me, and i will do this.

Wolfy7 avatar Oct 03 '22 10:10 Wolfy7

We should add then these new fonts as "Fallback" in all font resources

This is correct, this would be the best way to do it. And then test with some sample Japanese / Korean / Chinese text that it displays correctly in the editor (you can make label nodes, put the text in there and use the font resource on the labels)

For Chinese there are two, one for Simplified Chinese and one for Traditional Chinese

I would support simplified Chinese first, I think it's the one translation that'll quickly be completed.

NathanLovato avatar Oct 03 '22 11:10 NathanLovato

You got it all right! I just assigned you to this issue. If you'd like me to check your work before you spend too much time on this, you can open a pr that just modifies one font resource. But if you feel confident you can just go ahead and change all the font resources in one go.

NathanLovato avatar Oct 03 '22 11:10 NathanLovato

Oh and for the fonts I'd prefer sans serif. They read a little better I find when the text is too small. They look a bit more modern too.

NathanLovato avatar Oct 03 '22 11:10 NathanLovato

Alright, thank you.

I will work on this, probably later this day 😉

Wolfy7 avatar Oct 03 '22 11:10 Wolfy7

So what going on adding the chinese?

benpan2 avatar Aug 31 '24 05:08 benpan2

@benpan2 I invite you to read the first post in the issue about how we'd like this to be done. Developers are most welcome to contribute - this is something we don't have the time to work on now. The feature to download CJK fonts as needed hasn't been contributed yet.

NathanLovato avatar Aug 31 '24 09:08 NathanLovato

Instead of going straight for CJK I decided to go just for simplified Chinese, as we don't have nearly complete translations for other languages. I'll try to integrate Chinese in the next update.

NathanLovato avatar Oct 25 '24 09:10 NathanLovato