studio-minus / madness-interactive-reloaded

Moddable videogame based on Madness Combat
https://studiominus.nl/madness-interactive-reloaded.html
GNU General Public License v3.0
72 stars 14 forks source link

Game's fonts should support Cyrillic #209

Closed Krasapan closed 1 month ago

Krasapan commented 1 month ago

Describe the bug Cyrillic letters are invisible: game's fonts don't support Cyrillic (I think)

Steps to reproduce

  1. Download and extract the mod template
  2. Add the default en-GB.json locale from the source repo to you mod's assets structure ModName/assets/locale/en-GB.json, rename "DisplayName" string to your own language, rename the file name and "Culture" string to the corresponding locale code
  3. Do the translation to your own Cyrillic language
  4. Build your mod
  5. Set your language in game's options

Expected behavior Custom language works, but Cyrillic is not being displayed

Screenshots or video 2024-09-13_144155

https://github.com/user-attachments/assets/92c18711-0b7d-495e-966f-f88c5399f473

Desktop (please complete the following information):

Additional context I added each letter of the Ukrainian alphabet to the main menu strings to test the custom locale

SacredSven commented 1 month ago

I believe that this may be due to the Engine not knowing how to load fonts from MODS in specific, This may need to be added.

mestiez commented 1 month ago

The engine does know how to load fonts from mods. The described issue is accurate: the built-in fonts don't support Cyrillic. However, this isn't a bug. Adding Cyrillic characters would increase the font file size and I figured this is unnecessary for the base game.

You can always replace the base fonts with versions that include more characters, and include these in your mod.

SacredSven commented 1 month ago

The engine does know how to load fonts from mods. The described issue is accurate: the built-in fonts don't support Cyrillic. However, this isn't a bug. Adding Cyrillic characters would increase the font file size and I figured this is unnecessary for the base game.

You can always replace the base fonts with versions that include more characters, and include these in your mod.

Ah, my mistake. I misunderstood how the engine uses fonts. I thought it needed them in a specific location or it wouldn't load the fonts.

Krasapan commented 1 month ago

The engine does know how to load fonts from mods. The described issue is accurate: the built-in fonts don't support Cyrillic. However, this isn't a bug. Adding Cyrillic characters would increase the font file size and I figured this is unnecessary for the base game.

You can always replace the base fonts with versions that include more characters, and include these in your mod.

Got it I looked up game's fonts and they're in some weird .wf format that I can't find information about, what kind of font format is it and how can I convert regular font formats to this one So it isn't drag-n-drop .otf/.ttf solution like I thought it would be, so how can I add compatible fonts?

mestiez commented 1 month ago

You use wfont, installable as a dotnet tool:

dotnet tool install Walgelijk.FontGenerator -g

After this, in a terminal, navigate to a folder containing the font files (otf/ttf). For MIR, this is Oxanium, Impact, and Toxigenesis.

Create a charset file (charset.txt) in this folder. This is a text file with every character you would like to be included in the font. For your case, this would be extended ASCII and every relevant Cyrillic character. Maybe this is enough: charset.txt.

Then, run wfont --charset "charset.txt". Wait for a while, and you'll find a bunch of .wf files have been generated.

However, the game fonts may not support all characters, so you might need to look for alternative fonts... Let me know if there's any issues.