Godot Version
v4.3.stable.official
Question
I actually have 2 related questions. The first question is: how to make texts show in my game, whichever the language is set on the TranslationServer, without bugs? The secont question is: can I set a font for each item inside an OptionButton?
So I’ve uploaded a game to itch_io (this is the link in case anyone has to check it for more details). It works fine in both APK and EXE versions, but when exported for web and played from the web browser, all the texts in Japanese were affected by a bug known in Japanese as “mojibake”: when a software doesn’t know how to deal with a specific set of characters (in this case, Japanese characters), they are shown as weird characters instead.
Putting a <meta charset="utf-8">
inside the HTML file is usually how we solve this for web pages, but it doesn’t work for a web exported Godot project. One way to solve it is to download a font and set it as the project’s custom font: Project settings...
, Theme
under GUI
, Custom Font
, then set a font that has Japanese characters.
The problem with this approach is that now, the texts in Portugese are broken, because the font can’t deal with accented alfabet characters such as á
and ê
. I wonder why this bug doesn’t affect the APK (Android) and EXE (Windows) exports; they simply work with the default font.
I’ve read in the Official Documentation about font fallbacks, but ngl, I didn’t understand much of it. I’ve set the Gothic font (the one I’ve downloaded with Japanese characters) as fallback font but the game still showed weird characters instead of Japanese text.
The second question I ask because, whether I get the aforementioned bug fixed or not, I couldn’t find a way to set an individual font for each items in an OptionButton. So whether the current font is missing Japanese or accented alfabetical characters, it gets broken in one way or the other:
(font can’t deal with Japanese characters)
(font can’t deal with Portuguese accented alfabets)
So what’s the best approach for this? Any suggestion/help appreciated greatly.