[Guide] [1.39 - 1.42;1.43+] Custom fonts

Forum rules
SCS as a company do not wish to have paid mods on this forum. While we understand that not all paid mods use the Intellectual Property of other companies/people, it is very hard to moderate what is and isn't acceptable when money is involved. There are also concerns that it could look unfavorable to potential work partners going forward if SCS allow mods that may potentially use unlicensed branding.
Posting in the Mods forum (ATS and ETS2) is restricted to sharing free-to-the-public mods and providing support for mods. For more details, please check the Forum Rules.
User avatar
Etrusan
Posts: 650
Joined: 04 Sep 2014 15:29
Location: Brno, Czech Republic
Contact:

[Guide] [1.39 - 1.42;1.43+] Custom fonts

#1 Post by Etrusan » 11 Mar 2021 16:43

1.43+

With the introduction of MSDF fonts, it's a bit different to generate your font. On one hand SCS kindly provided their fontgen, on the other you can no longer make fonts by hand, they need to be as .ttf/.otf. If you have very specific font that doesn't exist in .ttf/.otf you can try to find a similar font, do it the old way and hope SCS won't remove support for legacy fonts or you can contract someone to make your custom font into .ttf/.otf.

To get the fontgen visit the SCS Wiki.

Simply edit your template, edit your chars, launch the correct .bat file and convert the newly created font using Conversion Tool.

Provided example config is basically useless, feel free to use this one instead:

Code: Select all

SiiNunit {

/*Default font locations:

	C:/Windows/Fonts/Font.ttf
	C:/Users/user/AppData/Local/Microsoft/Windows/Fonts/another_font.otf*/

//This will create multiple atlases with a single .font file. Order of characters will follow your "char_config" array. It is recommended to use as few atlases as possible.

	/*	configuration : nimbus.cfg {
	
			base: "base"
			output: "/font/nimbus"
			char_config[]: nimbus.other
			char_config[]: nimbus.numbers
			char_config[]: nimbus.all_latin
			line_spacing: 0
			default_scale: 1.00
		}
	
		char_set_config : nimbus.other {
	
			font_file:"C:/Users/Etrusan/AppData/Local/Microsoft/Windows/Fonts/nimbus-sans-l.regular.otf"
	
			size: 128
			scale_width: 1.0
			scale_height: 1.0
	
			character_set_file: "other.txt"	
	
		}
	
		char_set_config : nimbus.numbers {
	
			font_file:"C:/Users/Etrusan/AppData/Local/Microsoft/Windows/Fonts/nimbus-sans-l.regular.otf"
	
			size: 128
			scale_width: 1.0
			scale_height: 1.0
	
			character_set_file: "numbers.txt"	
	
		}
	
		char_set_config : nimbus.all_latin {
	
			font_file:"C:/Users/Etrusan/AppData/Local/Microsoft/Windows/Fonts/nimbus-sans-l.regular.otf"
	
			size: 128
			scale_width: 1.0
			scale_height: 1.0
	
			character_set_file: "all_latin.txt"	
	
		}
	*/

//This will create single atlas with a single .font file.

	/*	configuration : nimbus.cfg {
	
			base: "base"
			output: "/font/nimbus"
			char_config[]: nimbus.default
			line_spacing: 0
			default_scale: 1.00
		}
	
		char_set_config : nimbus.default {
	
			font_file:"C:/Users/Etrusan/AppData/Local/Microsoft/Windows/Fonts/nimbus-sans-l.regular.otf"
	
			size: 128
			scale_width: 1.0
			scale_height: 1.0
	
			character_set_file: "char_default.txt"	
	
		}
	*/

}
It should also be possible to have multiple fonts in a single atlas, however I couldn't get it working.

Please note it's not possible to select variable fonts. I'm trying to find a way to support them, but this will most likely need to be done from SCS' side.

If you change the name of the "example.sii", you also need to edit the .bat file to call the correct file.

I've compiled a list of characters to get you started quickly. Languages marked as "not" have not been checked by native speakers and thus might be wrong. If you could tell me if they are correct, let me know here.

List of possible parameters for the "configuration":
  • base:
    • where your base is, default is in the fontgen folder
  • output:
    • where the font will be created, name is the text after the last slash (nimbus in case of the example listed above)
  • char_config[]:
    • used characters and settings
  • line_spacing:
    • 2
    • suggested number of pixels to put between lines
  • default_scale:
    • 1.0
    • default font scale
  • include_escaped_charset:
  • vertical_span_bias:
    • 1
    • probably something to do with vertical_span which is max difference between lowest and highest pixel in any two glyphs
List of possible parameters for the "char_set_config":
  • font_file:
    • string
    • link to used font file
  • character_set_file:
    • string
    • link used characters
  • size:
    • EM
    • size of the font, around 64 seems reasonable, 128 is nearing the overkill region, everything above is wasted resources unless you need a really, really huge font
  • scale_width:
    • 1.0
    • X-scaling factor (applied when rendering)
  • scale_height:
    • 1.0
    • Y-scaling factor (applied when rendering)
  • base_color:
    • (1.0, 0.0, 0.0, 1.0)
    • optional base color, default (1, 1, 1, 1)
  • kerning_bias:
    • 2
    • glyph kerning bias in px at full scale
  • thickness_bias:
    • 2
    • glyph thickness bias in px at full scale
  • outline_width:
    • 1
    • outline width in px
  • outline_color:
    • (0.0, 0.5, 0.0, 1.0)
    • ouline color, default (0, 0, 0, 1)
  • shadow_angle:
    • -45
    • drop shadow angle in degrees
  • shadow_distance:
    • 2.0
    • drop shadow distance in px at full scale
  • shadow_alpha:
    • 0.4
    • drop shadow alpha (0-1)
  • shadow_size:
    • 2
    • drop shadow size in px at full scale, (0 -> hard shadow, >0 softer, spread out)
  • glow_color:
    • (0.0, 1.0, 0.0)
    • glow color
  • glow_size:
    • 5
    • glow size in px at full scale
  • bevel_angle:
    • -45
    • bevel angle in degrees (should be same as shadow for consistent lighting)
  • bevel_alpha:
    • 0.5
    • bevel alpha (0-1)
  • bevel_size:
    • 1.5
    • bevel size in px at full scale
  • sdf_range:
    • 8
    • if missing generated by the MSDF, use only when you need specific changes to the rendering
  • texture_size:
    • (1024x 512)
    • if missing generated by the MSDF, use only when you need specific size of the atlas, might compromise quality
You can also specify MSDF parameters:
  • additional_msdfgen_parameters:
    • string
    • "-errorcorrection full-auto"
1.39-1.42

Making fonts has never been easier, thanks to a tool called BMFont.
  • Select all the needed characters and edit the settings
    • The font descriptor (.fnt) is a text file
    • The texture is an 8bit .tga with glyphs in the alpha channel with no compression
  • Save it somewhere safe
  • Rename both files to the same name
    • Make sure to correct the texture name inside the .fnt file
  • Open <font_name>.fnt in BMFont2SCS
  • Save the output files and move them to their correct location (depends on the font usage)
    • Make sure to edit the final path in the .font file
  • Run Conversion Tools to convert .tga, and .tobj to game ready format
  • Don’t forget to donate to both BMFont and BMFont2SCS
BMFont2SCS was created by @Soundwave2142.

If you need extra characters that are not in the font, you either need to edit the font file before using BMFont or edit the generated texture and .fnt directly.
Last edited by Etrusan on 30 Dec 2021 10:22, edited 7 times in total.
Seasonic SSR-650TD; Intel Core i5-6700K; Gainward GTX 1060 6GB Phoenix GS; 2x Kingston HyperX Fury 8GB; 2x Crucial MX500 2TB; 3x Seagate IronWolf Pro; Corsair Force MP510 960GB; 2x 24" AOC I2481FXH; Windows 10

www.etrusan.net
User avatar
Etrusan
Posts: 650
Joined: 04 Sep 2014 15:29
Location: Brno, Czech Republic
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#2 Post by Etrusan » 25 Dec 2021 09:05

Updated for 1.43+
Seasonic SSR-650TD; Intel Core i5-6700K; Gainward GTX 1060 6GB Phoenix GS; 2x Kingston HyperX Fury 8GB; 2x Crucial MX500 2TB; 3x Seagate IronWolf Pro; Corsair Force MP510 960GB; 2x 24" AOC I2481FXH; Windows 10

www.etrusan.net
dclark12553
Posts: 20
Joined: 22 Nov 2017 01:00
Location: United States
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#3 Post by dclark12553 » 25 Dec 2021 19:38

Can you explain to me how to generate the font. Whenever I change anything in the example.sii, It will not generate the font at all.
User avatar
Etrusan
Posts: 650
Joined: 04 Sep 2014 15:29
Location: Brno, Czech Republic
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#4 Post by Etrusan » 26 Dec 2021 04:57

If the example.sii is incorrect then it won't generate anything. Have you tried with my template?
Seasonic SSR-650TD; Intel Core i5-6700K; Gainward GTX 1060 6GB Phoenix GS; 2x Kingston HyperX Fury 8GB; 2x Crucial MX500 2TB; 3x Seagate IronWolf Pro; Corsair Force MP510 960GB; 2x 24" AOC I2481FXH; Windows 10

www.etrusan.net
dclark12553
Posts: 20
Joined: 22 Nov 2017 01:00
Location: United States
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#5 Post by dclark12553 » 26 Dec 2021 19:44

Do I copy and paste your template into the existing example.sii?
User avatar
Etrusan
Posts: 650
Joined: 04 Sep 2014 15:29
Location: Brno, Czech Republic
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#6 Post by Etrusan » 26 Dec 2021 20:33

You can.
Seasonic SSR-650TD; Intel Core i5-6700K; Gainward GTX 1060 6GB Phoenix GS; 2x Kingston HyperX Fury 8GB; 2x Crucial MX500 2TB; 3x Seagate IronWolf Pro; Corsair Force MP510 960GB; 2x 24" AOC I2481FXH; Windows 10

www.etrusan.net
dclark12553
Posts: 20
Joined: 22 Nov 2017 01:00
Location: United States
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#7 Post by dclark12553 » 26 Dec 2021 21:00

Is it possible for you to make a video on how to get the whole process done?
User avatar
Etrusan
Posts: 650
Joined: 04 Sep 2014 15:29
Location: Brno, Czech Republic
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#8 Post by Etrusan » 27 Dec 2021 05:48

It's not.
Seasonic SSR-650TD; Intel Core i5-6700K; Gainward GTX 1060 6GB Phoenix GS; 2x Kingston HyperX Fury 8GB; 2x Crucial MX500 2TB; 3x Seagate IronWolf Pro; Corsair Force MP510 960GB; 2x 24" AOC I2481FXH; Windows 10

www.etrusan.net
User avatar
PaZz_
Posts: 240
Joined: 25 Apr 2018 17:41
Location: Germany

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#9 Post by PaZz_ » 29 Dec 2021 15:31

Thanks for all the information!

The game doesn't seem to like the generated tobj file though:

Code: Select all

<ERROR> [tobj] The file 'C:/Users/username/Documents/American Truck Simulator/mod/user_map/font/sign/new_font_0.tobj' has incorrect version - found 2070616d, expected 70b10a01.
Anyone else encountering this problem?
User avatar
Etrusan
Posts: 650
Joined: 04 Sep 2014 15:29
Location: Brno, Czech Republic
Contact:

Re: [Guide] [1.39 - 1.42;1.43+] Custom fonts

#10 Post by Etrusan » 29 Dec 2021 15:44

Did you convert the output of the fontgen using Conversion Tools?
Seasonic SSR-650TD; Intel Core i5-6700K; Gainward GTX 1060 6GB Phoenix GS; 2x Kingston HyperX Fury 8GB; 2x Crucial MX500 2TB; 3x Seagate IronWolf Pro; Corsair Force MP510 960GB; 2x 24" AOC I2481FXH; Windows 10

www.etrusan.net
Post Reply

Return to “Modding Guides”

Who is online

Users browsing this forum: LuminousMazim and 8 guests