GDQuest / learn-gdscript

Learn Godot's GDScript programming language from zero, right in your browser, for free.
https://gdquest.github.io/learn-gdscript/
Other
2.05k stars 151 forks source link

Add CJK font #497

Open NathanLovato opened 2 years ago

NathanLovato commented 2 years ago

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.

Wolfy7 commented 1 year ago

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"

NathanLovato commented 1 year ago

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 commented 1 year ago

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.

Wolfy7 commented 1 year ago

Hi. Thanks for make it clearer.

I had then just some addtional quqstions:

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

NathanLovato commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.

Wolfy7 commented 1 year ago

Alright, thank you.

I will work on this, probably later this day 😉

benpan2 commented 2 weeks ago

So what going on adding the chinese?

NathanLovato commented 2 weeks ago

@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.