Syntax of a Font Substitute file

Top  Previous  Next

A font substitute (.SUB) file consists of a number of sections, each starting with the keyword RTFONTSUBST (optionally followed by a comment). This is followed by a number of lines each consisting of a keyword and a string. The string must be enclosed in quotes if it contains any spaces. Keywords are:

MATCH 'fontname' where fontname may be wild-carded with * or ? for matching against the name of a downloaded font.

SELECT 'sel' where sel is a selection sequence defining the characteristics to be matched. The syntax is as for the PCL font selection but with no escape character e.g. (10U (s1p0s0B. The 10U in this example is the symbol set and for a description of the other parameters see 'PCL Font Selection Sequences' below.

NAME 'fontname' specified the substitute font name to be used in a PDF (or in PostScript output).

SUBST 'sel' specifies the selection sequence to be used for PCL output.

TTNAME 'fontname' specifies the TrueType font to be used on the screen.

CONV 'symbolset' specifies the symbol set to be used for character code conversion when extracting text. This could be null (no conversion), HP3 for a Windows driver or perhaps EBCDIC or -29 in some cases.

HEAD 'MD5string' specifies the MD5 signature of the font

A typical entry in a font substitute file might be:

RTFONTSUBST Arial

MATCH: 'Arial'

SELECT (s1p0s0B

SUBST (s16602T

NAME: 'Helvetica'

TTNAME: 'Arial'

PCL Font Selection Sequences

In the PCL language a font is selected either by its characteristics or, if it is a downloaded font, by the numeric ID that was assigned when it was downloaded.

For selection by ID the command is

Escape (<id>X

where <id> is a number in the range 0 to 32767.

For selection by characteristics the command is of the form

Escape (<prop>p<pointsize>v<pitch>h<style>s<weight>b<typeface>T

where:

<prop> is 1 if proportional, 0 if fixed pitch;

<pointsize> can have up to two decimal places and specifies the height in points (1/72");

<pitch> can have up to two decimal places and specifies the pitch in characters per inch (CPI);

<weight> is in the range -7 to +7. ( -3 = light, 0 = normal, 3 = bold etc.)

<style> is 1 if italic, 4 if compressed, 5 if italic compressed;

<typeface> is a 12-bit value with a manufacturer code in the higher bits.

Typical values are '3' for Courier, '5' for Times, '52' for Univers. When the code for Compugraphic (the supplier of the resident fonts on an HP printer) is added, these result in codes 4099, 4101 and 4148 respectively.

It is not compulsory to specify all the above characteristics, so the sequence can be terminated on an upper case letter. The sequences above are described in terms of the primary font but the secondary font uses the same syntax but with right bracket instead of left bracket e.g. Escape )10U. The 'shift out' (hex 0E) character then selects the secondary font, and 'shift in' (hex 0F) the primary.