Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Is there any way to add custom fonts for translation?  (Read 1610 times)

f0rK

  • Ensign
  • *
  • Posts: 5
    • View Profile
Is there any way to add custom fonts for translation?
« on: February 09, 2020, 12:00:56 PM »

My native language isn't English so I thought about making a fan translation of the game. But I stumbled upon a problem - game's fonts don't support Cyrillics. So is there a way to add custom fonts to the game that support it?

I've seen that post from 2013 where people were discussing custom fonts and someone mentioned BMFont program. I tried doing something with it, but I don't know the exact font and export options.

Also, when I tried to replace the Orbitron 20aa (I suspect that buttons use this font) font with my own custom Montserrat Medium I got Fatal 1 Error, what does it mean?

These are the last lines from starsector.log:

257  [Thread-2] INFO  com.fs.graphics.L  - Using refresh rate:60
794  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ui/launcher_bg.jpg (using cast)
812  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ui/launch_button_bg.png (using cast)
818  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ui/play_button0.png (using cast)
823  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ui/play_button1.png (using cast)
827  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ui/buttons/toggleA20x_on.png (using cast)
830  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ui/buttons/toggleA20x_off.png (using cast)
834  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/ui/buttons/arrow_down.png (using cast)
837  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/fx/scanline11.png (using cast)
858  [Thread-2] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/fonts/orbitron24aabold_0.png (using cast)
888  [Thread-2] FATAL com.fs.starfarer.launcher.opengl.GLLauncher  - java.lang.ArrayIndexOutOfBoundsException: 1
java.lang.ArrayIndexOutOfBoundsException: 1
   at com.fs.graphics.A.D.super(Unknown Source)
   at com.fs.graphics.A.D.super(Unknown Source)
   at com.fs.starfarer.launcher.opengl.GLLauncher.loadFont(Unknown Source)
   at com.fs.starfarer.launcher.opengl.GLLauncher.prepare(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.starfarer.launcher.opengl.GLLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

Any help would be really appreciated, because the forum is my last hope.
« Last Edit: February 10, 2020, 09:08:26 AM by f0rK »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #1 on: February 09, 2020, 01:07:24 PM »

It's definitely possible; the unofficial Chinese translation makes use of this. I'm not sure about the specific error, though. It means that the game wasn't able to parse the font file - it was looking for a numeric value there and there wasn't one - but it's impossible to say more specifically. I'd recommend comparing the .fnt file you've produced with the original the game uses to try to spot structural differences.
Logged

f0rK

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #2 on: February 10, 2020, 08:01:42 AM »

Thanks for the reply. I still don't know what exactly causes the Fatal 1 error. Some fonts are easily replaced by their custom versions that support Cyrillics and I even have some translation of the game that works. But some just crash.

If you still remember those, please tell the exact BMFonts export and font settings used for creation.

Thanks.
« Last Edit: February 10, 2020, 08:14:42 AM by f0rK »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #3 on: February 10, 2020, 08:43:16 AM »

IIRC the export settings were mostly defaults, I don't remember having to fine-tune it, beyond setting the output to PNG and 32 bit. If the game is able to load some of the fonts you're producing, then it's unlikely that the export settings are the problem. I'd once again recommend comparing what works with what doesn't; I'm not sure that anything else can really help.

... ah - if you're not already doing this, I'd make sure that in addition to Cyrillic, the font also contains "Latin + Latin Supplement"; the game will rely on some of the characters found there almost regardless of what you might do.

The font settings, I don't remember exactly what they were. Mainly it was finding a size where the font looked good - there were certain numbers where it did (iirc possibly multiples of 4? 12, 16, 20, 24) and it was blurry otherwise. I forget the details, though.
Logged

f0rK

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #4 on: February 10, 2020, 08:59:51 AM »

Thanks. I will try it ASAP.
Logged

f0rK

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #5 on: February 10, 2020, 09:07:40 AM »

I tried tweaking some values and it worked. No more Fatal 1 error is present so I can start working on translation now. Thanks again.
Logged

f0rK

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #6 on: February 10, 2020, 10:20:14 AM »

One last question. Can you tell what fonts correspond to what parts of the GUI, please? Thanks.
Logged

Mondaymonkey

  • Admiral
  • *****
  • Posts: 777
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #7 on: February 10, 2020, 11:15:13 AM »

game's fonts don't support Cyrillics

Cyrillics, you say?

*Interesting*

If forum do?

UPD: obviously not. :-\

One way or another, good luck.
« Last Edit: February 10, 2020, 11:18:15 AM by Mondaymonkey »
Logged
I dislike human beings... or I just do not know how to cook them well.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Is there any way to add custom fonts for translation?
« Reply #8 on: February 10, 2020, 12:54:24 PM »

One last question. Can you tell what fonts correspond to what parts of the GUI, please? Thanks.

I can't really list everything in too much detail, but, roughly:

These are used for various titles in tooltips, and button text:
"graphics/fonts/orbitron12condensed.fnt";
"graphics/fonts/orbitron24aabold.fnt";
"graphics/fonts/orbitron24aa.fnt";
"graphics/fonts/orbitron20aabold.fnt";
"graphics/fonts/orbitron20aa.fnt";
"graphics/fonts/orbitron20bold.fnt";

This is the "small" font - used in the combat UI in the bottom left, text on the Sector map, etc.
"graphics/fonts/victor10.fnt";
"graphics/fonts/victor14.fnt";

This is the main font used for text in tooltips etc:
"graphics/fonts/insignia15LTaa.fnt"

This font is scaled down to 18 pixels and used for a lot of text, such as when interacting with something in the campaign, or the description of something in a campaign tooltip:
"graphics/fonts/insignia21LTaa.fnt";

And this font is also a "text blocks" font but isn't used very much. I think mainly in some "Do you want to exit?" type dialogs.
"graphics/fonts/insignia25LTaa.fnt";
Logged