vfont_decompiler

From Valve Developer Community
Jump to navigation Jump to search

vfont_decompiler 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, and optionally decompile .vfont files back into .ttf font files when the decompile flag is specified.

This tool allows players to get around weak protections Valve implemented to comply with font licenses, and has never been officially shipped.

Info

vfont_decompiler is simply vfont compiled with the VFONT_DECOMPILER preprocessor definition enabled. Its source consists only of that definition followed by an include of vfont.cpp, so it shares all of vfont's behavior and adds the ability to decode .vfont files back to their source via the -d flag.

Features

  • Converts .ttf font files to the .vfont format (same as vfont)
  • Decodes .vfont files back into .ttf files with the -d flag
  • Automatically derives the output filename from the input when no output is specified

Technical Details

When run without -d, the tool encodes the input via ValveFont::EncodeFont, matching vfont. When the -d flag is passed, it invokes ValveFont::DecodeFont instead, decoding a .vfont file. Because the decompiler is always compiled in here, the -d flag is unconditionally available, unlike a standard vfont build.

When no output filename is provided, the output filename is derived from the input by replacing its extension with the appropriate extension.

Usage

Syntax

vfont_decompiler inputfile.ttf [outputfile.vfont]

vfont_decompiler -d inputfile.vfont [outputfile.ttf]

Parameters

-d
Decompiler mode. Decodes a .vfont file back into a .ttf file.
inputfile
The input file to process — a .ttf file when compiling, or a .vfont file when decompiling with -d.
outputfile
Optional output path. If omitted, the output filename is derived from the input.

Examples

# Compile a TTF into a VFONT
vfont_decompiler myfont.ttf myfont.vfont

# Decode a VFONT back into a TTF
vfont_decompiler -d myfont.vfont myfont.ttf

See Also

  • vfont - The compiler-only counterpart this tool is built from.
  • scryptor - A reimplementation of this tool, not based on leaked code, that allows for bidirectional drag and drop conversion.