Font Patcher: Difference between revisions
m typos |
m typo |
||
Line 89: | Line 89: | ||
== See also == | == See also == | ||
* [[I18N_-_Charset|The | * [[I18N_-_Charset|The charsets used by TDM]] | ||
* [[Font Conversion & Repair]] | * [[Font Conversion & Repair]] | ||
* [[I18N]] | * [[I18N]] | ||
[[Category:Fonts]] | [[Category:Fonts]] |
Revision as of 20:55, 7 November 2011
Introduction
This utility allows you to "patch" a fontImage.dat file, e.g. change different characters and values without having the other characters being affected (a common problem with q3font, f.i.).
The script 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
The order of commands does usually not matter, unless you want for instance to copy a character and then modify it, in this case the copy command must obviously come before any modifications to the character.
Patching multiple fonts
The modified fontImage.dat file will be written out automatically at the end of the parsing stage. If you want to patch more than one fontImage.dat file, you need to use two seperate command files and call the font patcher twice.
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 print all the fields for the character 0x65 (in this case "a") to the console:
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 "relocate" 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