Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95.1a is out! (12/10/21); Blog post: Of Slipstreams and Sensor Ghosts (09/24/21)

Author Topic: How to change the font used in game  (Read 6628 times)

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
How to change the font used in game
« on: January 23, 2013, 01:21:34 PM »

So i just changed the font on the startreker mod, heres how you do it,

You must have noticed the *.fnt and *.png files on the folder fonts right?
Its actually all made using a convenient tool that converts *.ttf (haven't tested but other formats should work) into those 2 files used by starsector.

1 - Download this tool: http://www.angelcode.com/products/bmfont/
2 - Get a font you want and "install" (you can actually select the files on the application but it didnt work)
3 -
Spoiler
[close]
4 -
Spoiler
[close]
Select the font you installed and want on Starsector - Set the size (in px) you actually want, also depends on the actual font default size;
5 -
Spoiler
[close]
6 -
Spoiler
[close]
Make sure you set those options like i got here;
7 -
Spoiler
[close]
Select the option then save the file into the graphics\fonts\ on you mod;

Dont forget that, if you have a different name on your *.fnt to add a settings.json file, with the different name on your mod:

Example:
Code
	# main color used for menu buttons and the like
"buttonBg":[0,150,255,255],
"buttonBgDark":[0,100,150,255],
"buttonText":[255,255,255,255],
"buttonShortcut":[100,100,255,255],
"defaultFont":"graphics/fonts/startreker_font.fnt",

How it looks ingame:
Spoiler
[close]
Spoiler
[close]

note: There might be better options on this program to get better results, i didn't mess with once i liked how the font came out in the end, if you do find, please share here.
« Last Edit: January 23, 2013, 01:41:38 PM by silentstormpt »
Logged

Romeo_One

  • Captain
  • ****
  • Posts: 390
  • "Let me do the german dance for you..."
    • View Profile
    • Rejection - The Fight for Unity
Re: How to change the font used in game
« Reply #1 on: January 23, 2013, 01:29:45 PM »

Ohh nice! Will try that out asap.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20014
    • View Profile
Re: How to change the font used in game
« Reply #2 on: January 23, 2013, 01:41:11 PM »

Ah yes, fonts. Good work figuring all that out :)

But! You forgot the most fun step: manually adjusting the .fnt file to make the spacing nicer. For example, you can see that the 'c' and the 'o' are a little too wide - with gaps after them. Some specific letter pairings may need to be adjusted individually, too (this is called "kerning" and is supported in the .fnt format).

Also, for fonts used for numbers, I tend to make the spacing of the number characters uniform so that they don't jump around when the numbers change (i.e., if you see speed: 121 and it changes to 120, you might see the spacing shift since the 1 is narrower than the 0 - making those characters have the same width avoids that.)

General hint: certain fonts look better at certain sizes when produced by that utility. Like, 24, 16, etc - depends on the font in question, but if you're seeing some fuzziness/aliasing/bad quality on the rendered font, it's a good idea to try nearby sizes.
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: How to change the font used in game
« Reply #3 on: January 23, 2013, 01:45:13 PM »

Ah yes, fonts. Good work figuring all that out :)

But! You forgot the most fun step: manually adjusting the .fnt file to make the spacing nicer. For example, you can see that the 'c' and the 'o' are a little too wide - with gaps after them. Some specific letter pairings may need to be adjusted individually, too (this is called "kerning" and is supported in the .fnt format).

Also, for fonts used for numbers, I tend to make the spacing of the number characters uniform so that they don't jump around when the numbers change (i.e., if you see speed: 121 and it changes to 120, you might see the spacing shift since the 1 is narrower than the 0 - making those characters have the same width avoids that.)

General hint: certain fonts look better at certain sizes when produced by that utility. Like, 24, 16, etc - depends on the font in question, but if you're seeing some fuzziness/aliasing/bad quality on the rendered font, it's a good idea to try nearby sizes.
Thanks for the hints

Question: Why not allow to change the characters fonts besides the ones already on the setting.json
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20014
    • View Profile
Re: How to change the font used in game
« Reply #4 on: January 23, 2013, 02:28:01 PM »

You can - you'd just have to replace those font files with whatever ones you want to use. So it's still be named insigina-something-or-other, but have the contents of another font. The one in settings.json probably *shouldn't* be there. This is definitely TC territory, though, as mods making these types of changes are unlikely to be able to coexist with one another (though ofc if only one mod is doing it that's fine.)

Btw - the values you want to tweak are xoffset (horizontal spacing before character is rendered) and xadvance (horizontal spacing after character is rendered, before the xoffset of the next character is added). You do NOT want to edit width and height - those are the width and height of the actual character glyph in the png file.
Logged