Skip to content

Vector fonts

Vector fonts draw text with TrueType and OpenType fonts embedded in tags. Unlike bitmap fonts, they are drawn at the size the screen needs, so they stay sharp at any resolution. Two new tag groups hold them:

Group Group code Purpose
vector_font_data vfnd The font file itself.
vector_font vfnt The font as the game draws it: size, placement, shadow, and the font file for each text style.

Where they are used

  • Interface fonts. When the engine looks up its default interface fonts, ui\small_ui, ui\large_ui, ui\ticker and ui\gamespy, it looks for a vector_font at that path first, and only then for a bitmap font. A map can replace those fonts by including vector_font tags with those paths.
  • Chat. The chat font can be a vector font. See balltze_set_chat_font.
  • Plugins. Text added by plugins with Engine.interface.addText can use a vector font.

vector_font fields

Field Meaning
font size Size of the text. It is scaled with the resolution.
offset x, y Offset applied to the text when it is drawn.
do not render shadow flag Draws the text without its drop shadow.
shadow offset x, y Where the drop shadow is drawn, relative to the text, in screen units.
ascending height Distance from the top of a line to the baseline.
descending height Distance from the baseline to the bottom of a line.
leading height Extra space above each line.
plain, bold, italic, condense, underline The vector_font_data used for each text style. A style without one uses the plain style.

When both the ascending and the descending height are zero, the metrics of the font file are used instead of the three height fields.

vector_font_data fields

Field Meaning
font family name Name of the font family. Read only.
format TrueType or OpenType. Read only.
font data The contents of the font file.