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"
}
*/
}
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:
- true/false
- whether or not to include escape characters
- vertical_span_bias:
- 1
- probably something to do with vertical_span which is max difference between lowest and highest pixel in any two glyphs
- 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
- additional_msdfgen_parameters:
- string
- "-errorcorrection full-auto"
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
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.