Skip to content

FreeType

RM edited this page Apr 21, 2020 · 1 revision

How to use FreeType fonts for mod creators.

ET: Legacy clients

ET: Legacy clients can directly use FreeType fonts:

  • Put the desired .ttf font file into the mod fonts folder
  • In a UI script, specify a font, smallFont, and bigFont keyword with the TTF font name and point size.

Default fonts and point sizes are:

  • ariblk with point size 27
  • courbd with point size 30

TrueType and OpenType fonts saved in the fonts directory will be loaded automatically. By default client loads ariblk.ttf and courdb.ttf font files.

Note: All the vanilla Microsoft licensed font files have been replaced by free software fonts (Arial Black → LiberationSans-Bold and Courier New → Courier Prime Bold).

ET 2.60b clients

As the original client cannot directly use FreeType fonts, font textures files need to be generated:

Note: This is not needed for ET: Legacy clients.

  • Copy the TrueType font files that you want to use to the mod fonts directory, e.g. rename DejaVuSans.ttf to legacy/ariblk.ttf and legacy/courbd.ttf
  • Run the game with +set r_saveFontData 1. You must specify r_saveFontData before the game is started, as it will get reset when you restart the game.
  • Exit the game and there will be three .dat files and at least three .tga files.

The .tga files are in 256x256 pages so if it takes three images to render a 24 point font. You will end up with fontname_0_24.tga through fontname_2_24.tga.

In further runs of the game, the system will look for these images and data files when a specific point sized font is rendered and loads them for use. You might want to hand touch the font bitmaps.