Fonts in GemRB (as well as original IE games), aren't fonts in the traditional sense. The fonts are actually a simple sprite with each glyph rendered in order (ie A-Z). Image resources for these sprites are stored in IE BAM files. Implications of this method are:
Technically TrueType fonts aren't limited in the same ways as “BAM” fonts. However, in order to support most of what TTF is capable of an that is important without having to write a new font renderer/breaking BAM support, TTF fonts in GemRB are done as Sprites in the same manner as the original fonts. What this means is that while the fonts are static once created we can supply parameters at engine start to create them in any size and any style supported by any TTF font you have available.
The TTF plugin for GemRB requires these libraries:
Inside GemRB's “unhardcoded” folder there are subfolders for each game type which contain fonts.2da files for each game. These files tell GemRB how to construct fonts for a given “resref”.
2DA V1.0 NORMAL RESREF NEED_PALETTE FONT_NAME PT_SIZE STYLE COLOR 0 NORMAL 1 NORMAL 14 0 0xffffffff 1 INFOFONT 1 INFOFONT 14 0 0xffffffff 2 NUMBER 0 NUMBER 14 0 0xffffffff 3 INITIALS 0 INITIALS 14 0 0xffffffff 4 NUMBER2 0 NUMBER2 14 0 0xffffffff 5 NUMBER3 0 NUMBER3 14 0 0xffffffff 6 NUMFONT 1 NUMFONT 14 0 0xffffffff 7 REALMS 0 REALMS 14 0 0xffffffff 8 REALMS2 1 REALMS2 14 0 0xffffffff 9 STONEBIG 0 STONEBIG 14 0 0xffffffff 10 STONESM2 0 STONESM2 14 0 0xffffffff 11 STONESM3 0 STONESM3 14 0 0xffffffff 12 STONESML 0 STONESML 14 0 0xffffffff 13 TOOLFONT 1 TOOLFONT 14 0 0xffffffff 14 STATES 0 STATES 14 0 0xffffffff 15 STATES2 0 STATES2 14 0 0xffffffff
The columns: FONT_NAME, PT_SIZE, and STYLE are for TTF fonts only. FONT_NAME is the file name (NOT the path) of the TTF font you wish to use, and PT_SIZE controls the size of the font. STYLE controls the font style and accepts the following values:
COLOR is the RGBA hexidecimal color to use to create the color palette. It applies to BAM fonts only if NEED_PALETE is set. It applies to TTF fonts regardless of the value of NEED_PALETE
In GemRB.cfg you must specify the following option (or copy the fonts to GamePath/override):
You may mix and match BAM and TTF fonts however you like.
TODO: move this section somewhere else (its own page?)
If you have a multibyte encoded dialog.tlk; you will have to add the Encoding setting to your gemrb.cfg. Set Encoding = to your language and make sure that an ini file matching your language exists under unhardcoded/shared. If no ini file matching your language exists, one must be created.
To create your own language.ini, make a new text file like this (Chinese example):
[encoding] TLKEncoding = GBK
After you have a working language.ini, you should be able to play using either Unicode compatible TTF fonts or the BAM fonts supplied with your language pack.