A complete font conversion tool for DiRT Rally 2.0 - Convert TrueType/OpenType fonts to MTSDF format with XML libraries
- Features
- Quick Start
- Installation
- Usage
- Font Viewer
- Output Files
- Tips & Best Practices
- Troubleshooting
- Project Structure
- Credits
- One-Click Conversion: Complete font pipeline automation
- MTSDF Atlas Generation: High-quality multi-channel signed distance field rendering
- XML Library Export: Automatic generation of all required library files
- DDS Conversion: Automatic texture compression for game compatibility
- Font Viewer: Built-in coordinate comparison and inspection tool
- Custom Character Sets: Support for any Unicode characters including CJK
- User-Friendly GUI: Simple interface with preset configurations
- Place your font file (
.otf,.ttf) in thewitchs_pot/folder - Run
Dr2 Font Generator.exe - Select your font from the dropdown
- Click "Run" button
- Find output in
witchs_gift/folder
- Download latest
Dr2_Font_Generator_v*.zipfrom Releases - Extract to any folder
- Run
Dr2 Font Generator.exe
# Clone repository
git clone https://github.com/yourusername/Dr2-Font-Generator.git
cd Dr2-Font-Generator
# Install dependencies
pip install -r requirements.txt
# Run build script
build.batgraph LR
A[Font File] --> B[MTSDF Generation]
B --> C[JSON to XML]
C --> D[Library Merge]
D --> E[DDS Conversion]
E --> F[Output Files]
| Setting | Description | Default |
|---|---|---|
| Font File | Source font file (.otf, .ttf) | - |
| Charset File | Character set to render | charset.txt |
| Setting | Description | Recommended | Range |
|---|---|---|---|
| Font Size | Output resolution in pixels | 42 |
40-120 |
| Distance Field Pixel Range | SDF sampling range | 4 |
2-8 |
| Output Filename | Base name for output files | - | - |
Presets Available:
din_cnd_bold_ita_msdf_0- DIN Condensed Bold Italicdin_cnd_bold_msdf_0- DIN Condensed Boldroboto_cnd_reg_msdf_0- Roboto Condensed Regular
Create a .txt file with all characters you want to render, wrapped in quotes:
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()"
To include special characters, use escape sequences:
| Character | Escape Sequence | Example |
|---|---|---|
Double quote (") |
\" |
"Hello \"World\"" |
Backslash (\) |
\\ |
"Path\\to\\file" |
Basic ASCII:
" !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
With Quotes and Backslash:
"ABC\"DEF\\GHI"
Renders: ABC"DEF\GHI
Korean + English:
"ABCabc123가나다라마바사"
Note: Charset files must be saved as UTF-8 encoding.
The built-in Font Viewer allows you to inspect and compare font coordinates between original and newly generated fonts.
- Click "Launch Font Viewer" button
- Enter characters to compare:
- Single character:
A - Multiple characters:
ABC - Comma-separated:
A,B,C
- Single character:
- View comparison results:
- Position coordinates (X, Y, Z)
- UV texture coordinates
- Font metrics (bearing, advance, etc.)
- Visual overlay comparison
- Show Original: Toggle original font display
- Show New: Toggle new font display
- Apply Baseline Transform: Align fonts by baseline
- Show Glyph Images: Display actual character images
- Check File Paths: Verify all required files exist
- Clear Canvas: Reset display
After successful generation, the following files will be created in witchs_gift/:
| File | Description |
|---|---|
font-atlas.json |
Font metadata and glyph information |
[filename].png |
MTSDF atlas texture (PNG format) |
[filename].dds |
DDS texture ready for game import |
node.xml |
Merged XML node library |
| File | Description |
|---|---|
LIBRARY_NEFONTMETRICS.xml |
Font-level metrics (scale, ascender, descender) |
LIBRARY_NEGLYPHMETRICS.xml |
Per-glyph metrics (advance, bearing, size) |
LIBRARY_NODE.xml |
Render nodes and geometry |
LIBRARY_RENDERINTERFACEBOUND.xml |
Render interface bindings |
LIBRARY_SEGMENTSET.xml |
Data segments |
LIBRARY_SHADERGROUP.xml |
Shader group definitions |
LIBRARY_SHADERINSTANCE.xml |
Shader instances |
Font file not found
Symptom: "No font files" or file not appearing in dropdown
Solution:
- Verify font file is in
witchs_pot/folder - Check file extension (
.otf,.ttf) - Click "Refresh File List" button
- Restart the application
Characters not rendering
Symptom: Missing characters in output
Solution:
- Check if characters are included in your charset file
- Verify charset file is UTF-8 encoded (not ANSI)
- Use
\"to escape double quotes in charset - Try selecting "basic" charset as a test
Output looks blurry or pixelated
Symptom: Poor quality text rendering
Solution:
- Increase font size to 90 or higher
- Increase distance field pixel range to 5-6
- Check source font quality
- Reduce number of characters to allow larger atlas
Program crashes during generation
Symptom: Application stops responding
Solution:
- Reduce font size (try 60)
- Reduce number of characters in charset
- Close other applications to free memory
- Check log for specific error messages
DDS conversion fails
Symptom: PNG generated but no DDS file
Solution:
- Check if PNG file exists in
witchs_gift/ - Verify PNG is valid (can be opened in image viewer)
- Ensure sufficient disk space
- Try running as administrator
Dr2-Font-Generator/
├── Dr2 Font Generator.exe # Main application
├── user_config.json # Auto-saved user settings
├── README.md # This file
│
├── witchs_pot/ # INPUT FOLDER
│ ├── *.otf, *.ttf # Your font files
│ └── charset.txt # Character set definition
│
├── witchs_gift/ # OUTPUT FOLDER
│ ├── font-atlas.json # Font metadata
│ ├── *.png # Atlas texture (PNG)
│ ├── *.dds # Atlas texture (DDS)
│ ├── node.xml # Merged node library
│ └── generated_library/ # Separate XML libraries
│ ├── LIBRARY_NEFONTMETRICS.xml
│ ├── LIBRARY_NEGLYPHMETRICS.xml
│ ├── LIBRARY_NODE.xml
│ ├── LIBRARY_RENDERINTERFACEBOUND.xml
│ ├── LIBRARY_SEGMENTSET.xml
│ ├── LIBRARY_SHADERGROUP.xml
│ └── LIBRARY_SHADERINSTANCE.xml
│
├── original_texture/ # Reference textures (bundled)
└── separated_libraries_raw/ # Reference libraries (bundled)
After generating font files, you need to import them into the game using these tools:
- Download and use NeFS Editor to open
game.nefs - Extract the following files:
- Fonts:
frontend/fonts/roboto_cnd_reg.pssgfrontend/fonts/din_cnd_bold.pssgfrontend/fonts/din_cnd_bold_ita.pssg
- Font Textures:
frontend/bundles/b_fonts_def.pssg
- Fonts:
- Download Ego PSSG Editor
- Import Font Node:
- Open your font file (e.g.,
din_cnd_bold.pssg) - Go to "All Nodes" tab
- Click on "PSSGDATABASE"
- Click "Node-Import" button
- Select the generated
node.xmlfromwitchs_gift/ - Save the file
- Open your font file (e.g.,
- Import Font Texture:
- Open the font texture file (
b_fonts_def.pssg) - Go to "Textures" tab
- Select the texture matching your generated DDS name
- Click "Import" button
- Select the generated
.ddsfile fromwitchs_gift/ - Repeat for each texture position if needed
- Save the file
- Open the font texture file (
- Use NeFS Editor to replace the modified PSSG files back into
game.nefs - Done! Your custom font is now in the game
- msdf-atlas-gen by Viktor Chlumský - Multi-channel signed distance field atlas generator
- texconv by Microsoft - DirectX texture converter
- NeFS Editor by EgoEngineModding - Archive editor for Ego Engine
- Ego PSSG Editor by Petar - PSSG file editor for Ego Engine games
Created for the DiRT Rally 2.0 modding community
XML conversion code adapted from EgoEngineModding libraries
This tool is provided as-is for use with DiRT Rally 2.0. Please respect the licenses of included external tools.
Happy Font Modding! If you encounter any issues or have suggestions, please open an issue on GitHub.