ExportFontToDoom3
Intro to ExportFontToDoom3 & ExportFontToDoom3All256
The Windows command-line utility "ExportFontToDoom3" was created by Australian modder Grant Davies in 2005 to get TrueType Fonts, standard on Windows, into the metadata+bitmaps form needed by the Doom 3 engine. His final version, 1.02, was released as open-source and substantially used for TDM. It relies on the open-source DevIL and Freetype2 libraries.
ExportFontToDoom3 exports only the bitmap glyphs assigned to codepoints in the range 0-127, routinely the ASCII characters. The output actually generates metadata for 256 characters, but, due to a bug, upper-half characters are just mapped to the "undefined character" glyph.
ExportFontToDoom3All256 fixes that bug; it exports the glyphs assigned to codepoints in the range 0-255, routinely ANSI characters. It is also easier to run on modern Windows PCs, so recommended. It takes the same command-line arguments as ExportFontToDoom3. Credits to Crispy (for 2009 fix) and (in 2024 form) Geep.
Using the Tool
The information here is adapted from the description doc included with the ExportFontToDoom3 download.
Basic Command
To export with the common settings of 12, 24, and 48 point fonts, simply type:
ExportFontToDoom3All256 font_filename
For example (and assuming here a font "badtimes" with no legal issues):
ExportFontToDoom3All256 badtimes.ttf
Most standard font formats (from the 2009 timeframe) can be used for export, but TrueType is most common.
Size Option
To export the font in a certain size, use the option:
-size font_pointsize
For Doom3/TDM, only the sizes 12, 24, and 48 should be chosen. More than one "-size" arguments may be specified, for example:
ExportFontToDoom3All256 badtimes.ttf -size 12 -size 24
As indicated above, if no "-size" argument is specified, 12, 24, and 48 point fonts are exported.
Name Option
To name the font to be exported, use the option:
-name fontname
By default, the fontname is instead extracted from the font file. In either case, this fontname string will begin each of the TGA filename(s), which are referenced in turn in the per-character "shaderName" fields of the DAT file.
Other Options
In the description doc, there is a great deal of technical discussion about these next options, but of little likely relevance to TDM nowadays. Just ignore them in favor of their default values.
-textureFormat format
where the default is .tga, which is what you want. Use another tool to convert the output from .tga to .dds, since ExportFontToDoom3 won't do it correctly.
-xOffsetFix type
where the default is "none", which causes the font's X offset value to be exported to the "pitch" member of TDM .dat file. There is also the related:
-noXOffsetWarnings
Output
A new folder will be created and all output files will be stored there. The folder will be named according to the font being exported. The output will consist of Targa image (.tga) files and .dat files.
Afterwards, from each TGA, you should create a corresponding DDS file.
Deployment & Further Adaptions
After export, assuming you have an FM set up to test them, rename the files into standard form and move or copy them to the expected locations...
- For DAT files: fonts/english/<your font name>/
- For DDS files: dds/english/<your font name>/
You'll undoubtedly have to make further iterative adjustments to both the DAT files (using other methods listed in Font Conversion & Repair) and bitmap files. For instance, the "glyphScale" value will likely have to be changed.
Tutorials that Include ExportFontToDoom3
Doom3-era tutorials, once posted on www.doom3world, can still be found with the "wayback machine" links given here:
Downloads of ExportFontToDoom3All256
Windows binary and required archived versions of FreeType and DevIL DLLs:
This version, having been rebuilt, does not require legacy msvcp71.dll & msvcr71.dll files needed to run ExportFontToom3 v 1.02. For more about the modification and rebuild process, see "ReadMe_about_All256.txt", included in the foregoing .zip download.
The C++ project file with source code:
- [COMING SOON]
Downloads of ExportFontToDoom3 v 1.02
Windows binary:
Required DLLs: To use ExportFontToDoom3 v 1.02 binary, you must have msvcp71.dll & msvcr71.dll installed in Windows or (more practical and safe now) in the same folder as the .exe. Once common, these files are no longer available from Microsoft (and purged from GitHub projects too). If you have an old machine with pre-Win10 OS, you can probably copy them from there. Otherwise, TDM's ATI Compressonator zip has them, at DDS Creation with ATI Compressonator; or various sketchy dll sites.
The C++ project file with source code:
- Grant Davie's project page
- Moddb downloads page
- also from wayback machine.
The project makes use of the circa-2005 FreeType font library (www.freetype.org) and DevIL image library.