+2 votes

Hello, I have put some code in to change the language on my game and the code works fine for things like English, French, German etc but when I try to add characters like Japanese or Hindi it just displays a blank line on the text. I added some english characters between the words and these show up but the characters for japanese etc dont. Does anyone know what I need to do to have these characters work?

Godot version 3.2.3
in Engine by (1,363 points)

After extensive reading of the godot documentation I have found the following paragraph hidden in the fonts section

"Note: If a DynamicFont doesn't contain a character used in a string, the character in question will be replaced with codepoint 0xfffd if it's available in the DynamicFont. If this replacement character isn't available in the DynamicFont, the character will be hidden without displaying any replacement character in the string."

It seems therefore that the font I am using doesnt have these characters and the default behaviour when that is the case is to show nothing. I am currently investigating how I can change fonts in code whenever the language is changed. This is a big pain in the proverbial to be honest!

Hi Gluon, I've answered your question already if you want to check it out below.
tl;dr: https://i.imgur.com/1xHTxVm.gif

Thanks Yuminous I appreciate that, your answer was very helpful. I have now been able to fully implement the change of languages code and it all works. Quite a pain but its all sorted. Thanks so much for your help

I mean, I'm glad you got it sorted, but you shouldn't need to worry about coding anything to support multiple languages.

Font array/fallbacks would allow you to drag and drop all your fonts in one place, which you could then reuse on everything. Maybe for your next project, give it a try! It should be a lot more straightforward and painless.

Thanks Yuminous, I wish I had known about fallbacks sooner lol. Still thanks to you I know now and maybe this thread will help someone else as well. Thanks again for all your help

1 Answer

+2 votes
Best answer

You need to find and use extra fonts which have those characters/glyphs.
The default font (Droid Sans) as well as the vast majority of fonts you'll find will only support Latin characters.

There are, of course, many many which do, so the solution is to gather a selection of suitable fonts that have the glyphs you need, Noto is one such example.

Comparison of Different Fonts

An important note: very few font files that actually contain multiple writing systems in them, since the file size quickly becomes ginormous (which can affect load times).

Japanese + Latin

So you'll need to individually pick each language family you need, apart from Latin.

enter image description here
A great resource for this is Google Fonts. Practically all of the fonts there are free for commercial use. And you can mix and match fonts as you please, as we push the actual work of figuring out which font to use onto Godot.

By using the Fallback array in your Custom Font > Dynamic Font, you can specify as many different writing systems as you need. It's a little easier once you see it:

Multipleā€“Language Font

I hope that it helps!

by (1,000 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.