Font Patcher
Introduction
This utility allows you to "patch" a fontimage.dat file, e.g. change different characters and values without having the other characters getting affect (a common proble with q3font, f.i.).
The file reads in a fontimage.dat file, a file with commands, then executes each command and then writes out the modified fontimage.dat file. Here is an example command file:
source font_source/carleton/fontimage_48.dat target ../fonts/english/carleton/fontimage_48.dat // the texture for this font is 256x256 pixel dim 256 256 copy_char 0x43 0xac // copy all fields from C to the new character Č move_by 0xac 74 -52 // (new position 174, 19 minus 100, 71 shader 0xac fonts/carleton_6_48.tga // set the right texture file (the .tga here is ignored by D3) extend_top 0xac 8 // extend the character 8 pixel on the top
Commands
#include
Includes the specified file in place of this line. Example:
#include devel/font_source/copy_letters.txt
#define
Defines a new text to be replaced. Example:
#define H_EXTEND 1 extend_botton 0x65 H_EXTEND
copy_char
Copy all fields from the source character to the target character:
copy_char 0x43 0xac
Afterwards character 0xac will look exactly the same as 0x43 (C).
dump
This will dump all the fields for the character 0x65 (in this case "a"):
dump 0x65
extend_bottom
Extend the character at the bottom by the specified number of pixels (see dim):
extend_bottom 0xac 8
extend_top
Extend the character at the top by the specified number of pixels (see dim):
extend_top 0xac 8
increase_height is an alias for this command.
move_by
Moves the origin of the character bitmap by the specified number of pixels relatively to the original origin, and relative to the size of the texture (which you need to set beforehand with dim):
move_by 0xac 74 -52
This is often used to "reloacte" the place where a character is painted on the texture from one texture to the other, by using it in combination with shader.
shader
Each character is painted on a TGA (or better DDS) file, and this command lets you set the name of this file. Note that we specify here ".tga", even tho the actual files are ".dds", and also note that we do not store the language here. In this example, the real file used would be dds/fonts/english/carleton_6_48.dds - D3 will do this automatically for us:
shader 0xac fonts/carleton_6_48.tga