How to use FreeType for modders

Note: Since ET: Legacy 2.75 all the vanilla microsoft licensed font files have been replaced by free software fonts. See ETL_readme.txt in fonts folder of pak3.

To use FreeType font inside ET: Legacy mods do the following:

  1. Download ET: Legacy 2.75 or compile ET: Legacy with FreeType support by enabling FEATURE_FREETYPE in CMake configuration.
  2. Put your desired ttf font file into mods font folder
  3. In a UI script, specify a font, smallFont, and bigFont keyword with ttf font name and point size.
    See default fonts specified in source:src/ui/ui_loadpanel.c are (see above note):
    • "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 (Arial Black → LiberationSans-Bold) and courdb.ttf (Courier New → Courier Prime Bold.ttf) font faces.

Generating font textures for ET 2.60b

To generate new font data for use in vanilla ET you need to go through the following steps. This is not needed for ET:L clients.

  1. Copy truetype font that you want to use to your fs_game/fonts directory
    • e.g. rename DejaVuSans.ttf to legacy/ariblk.ttf and legacy/courbd.ttf
  2. Run the game with +set r_saveFontData 1.
    NOTE: you must specify r_saveFontData before the game is started. Setting it ingame is pointless as it will get reset to 0 when you restart the game.
  3. Exit the game and there will be three dat files and at least three tga files.
    The tga’s 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
  4. In future runs of the game, the system looks for these images and data files when a specific point sized font is rendered and loads them for use.
  5. Because of the original beta nature of the FreeType code you will probably want to hand touch the font bitmaps.

etl_unicode_test.jpg - ET:L displaying various alphabets (102 KB) Radegast, 04.01.2015 15:00