vfont

From Valve Developer Community
Jump to navigation Jump to search

vfont is a command-line tool used by Valve to convert TrueType font (TTF) files into .vfont files used in Left 4 Dead engine branch Left 4 Dead engine branch and newer.

Info

Features

  • Converts .ttf font files to the .vfont format
  • Automatically derives the output filename from the input when no output is specified
  • Optionally includes a decompiler mode (compiled in via the VFONT_DECOMPILER preprocessor definition) to decode .vfont files back out

Technical Details

The tool reads the entire input file into a buffer, encodes it via ValveFont::EncodeFont, and writes the result to the output file. When built with VFONT_DECOMPILER defined, passing the -d flag invokes ValveFont::DecodeFont instead, decoding a .vfont file.

When no output filename is provided, the tool copies the input filename and replaces its extension with .vfont. If the input has no extension (or the last dot appears before the final path separator), the .vfont extension is appended to the end.

Usage

Syntax

vfont [-d] inputfont.ttf [outputfont.vfont]

Parameters

-d
Decompiler mode. Decodes a .vfont file back to its source. Only available when compiled with VFONT_DECOMPILER defined.
inputfont.ttf
The input TrueType font file to convert.
outputfont.vfont
Optional output path. If omitted, the output filename is derived from the input by replacing its extension with .vfont.

Examples

# Convert a TTF, deriving the output name automatically
vfont myfont.ttf

# Convert a TTF to a specific output file
vfont myfont.ttf myfont.vfont

# Decode a VFONT back out (requires decompiler build)
vfont -d myfont.vfont myfont.ttf

See Also

  • scryptor - A reimplementation of this tool, not based on leaked code, that allows for bidirectional drag and drop conversion.