![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Gluon |
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?
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!
Gluon | 2021-08-08 09:58
Hi Gluon, I’ve answered your question already if you want to check it out below.
tl;dr: https://i.imgur.com/1xHTxVm.gif
Yuminous | 2021-08-08 10:13
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
Gluon | 2021-08-08 10:53
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.
Yuminous | 2021-08-08 11:21
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
Gluon | 2021-08-08 11:53