FONTDEFS

From ZDoom Wiki
Jump to: navigation, search

This is lump used to define custom fonts. There are two types of definitions to be aware of in defining your FONTDEFS lump: templated and explicit.

Templated fonts follow some simple rules to attribute a graphical lump to each character. Explicit fonts need to list each character and its associated lump explicitly.

Templated lists

The following keywords are used in font definitions:

BASE
The code number of the first character. If omitted, this is 33 by default, same as FIRST. However, this can be a different value. For example, if the character lumps are numbered CHAR01 to CHAR26, you would use BASE 1 instead of BASE 33 (and in this example, you would also need FIRST 65 and COUNT 26).
COUNT
The total number of characters. If omitted, this is 223 by default.
CURSOR
Sets a graphical lump to be used as the insertion cursor if the font is used on a text input field.
FIRST
The ASCII value of the first character. If omitted, this is 33 by default; the ASCII value for the exclamation mark.
SPACEWIDTH
Explicitly defines the pixel width of a space character. (New from 2.7.1)
TEMPLATE
This keyword is used to create the names for the individual lumps, using the same formatting commands as the C function MiniWikipediaLogoIcon.pngprintf applied to the character's ASCII code. Also, lower case characters are possible; just add the CFONT*** lumps for the lower case characters and they will be used automatically, with the following ranges: A = 65; Z = 90; a = 97; z = 122

Explicit lists

These keywords are implemented for regular fonts - only for ones with explicit patches.

CURSOR
Sets a graphical lump to be used as the insertion cursor if the font is used on a text input field.
NOTRANSLATION
This excludes the listed palette indices from being colorized.

Predefined fonts

"DOOMFONT"

The standard message font is called "Smallfont" or "Doomfont" in ACS. You can replace the smallfont by creating a new font with the name SMALLFNT. Otherwise, it is created from a collection of existing separate lumps. Doom and Strife feature STCFNxyz lumps, where xyz are the decimal number for the character's ASCII code (e.g., 'A' is STCFN065). Strife also feature an alternate font, SmallFont2, created in the same way from the STBFNxyz lumps. In other games, SmallFont2 is just an alias for SmallFont. In Heretic and Hexen, it is created from the FONTAxy lumps, where xy are the character's ASCII code minus 32 (e.g., 'A' is FONTA33).

Notes: Doom's character STCFN121 does not actually correspond to 'y' but to '|', which should be STCFN124; ZDoom remaps it appropriately in consequence, unless the 'x' and 'z' characters (STCFN120 and STCFN122) are also provided. The glyphs in Heretic and Hexen correspond to upper-case characters, even if they look like lower-case characters.

You can use this example as a guide to creating your own fonts.

   FONTNAME
   {
       Template CFONT%03d
   }

Where "FONTNAME" and "CFONT" are names appropriate to your own project.

"STATUSFONT"

This font only needs to contain the characters you need to print the health and armor display.

   STATUSFONT
   {
       0 STTNUM0
       1 STTNUM1
       2 STTNUM2
       3 STTNUM3
       4 STTNUM4
       5 STTNUM5
       6 STTNUM6
       7 STTNUM7
       8 STTNUM8
       9 STTNUM9
       % STTPRCNT
       / STTSLASH
       - STTMINUS    
       NOTRANSLATION 109	// don't touch the shadow color!
   }

"INDEXFONT"

The INDEXFONT is just a leftover definition that isn't used. To replace the smaller numbers that display the ammo count on the right hand side of the stat-bar, simply replace the graphic lumps themselves.

   INDEXFONT
   {
       0 STYSNUM0
       1 STYSNUM1
       2 STYSNUM2
       3 STYSNUM3
       4 STYSNUM4
       5 STYSNUM5
       6 STYSNUM6
       7 STYSNUM7
       8 STYSNUM8
       9 STYSNUM9
       NOTRANSLATION 160
   }

See also