The Printer Font Metrics (PFM) files for PCL printers have the following form:
PFMHEADER Header; /* font header */
WORD WidthTable[]; /* variable-width fonts only */
PFMEXTENSION Extensions; /* extensions */
char DeviceName[]; /* printer device name */
char FaceName[]; /* font name */
EXTTEXTMETRIC ExtTextMetrics; /* extended-text metrics (optional)*/
WORD ExtentTable[]; /* unscaled character widths */
DRIVERINFO DriverInfo; /* driver-specific info (optional)*/
PAIRKERN KerningPairs[]; /* pair-kerning table (optional) */
KERNTRACK KerningTracks[]; /* track-kerning table (optional) */
The width table is present if the dfPixWidth member is zero, which indicates a variable-width font. (Otherwise, for fixed-width fonts the width of all the characters in the font equals the value in the dfPixWidth member and no width table is given.) The width table is an array of words containing the widths in device units of characters in the range from dfFirstChar to dfLastChar. The width of a character c can be located using the formula:
width = WidthTable [c - dfFirstChar]
The size of the table is dfLastChar – dfFirstChar + 2 words. The last word is not used and is set to zero; it should be present for compatibility with the Windows screen-font file format.
If your font contains kern pairs, you must fill in the EXTTEXTMETRIC structure to indicate the number of kern pairs. Do not leave the other members blank; fill them in with reasonable values in the event an application uses them.
Eventually, there will be PFM files that describe scalable PCL fonts. To guarantee that your raster fonts are never interpreted as scalable fonts, make sure that the members for scaling information in the EXTTEXTMETRIC structure indicate a nonscaling font:
etmMasterHeight = etmMasterUnits = etmMinScale = etmMaxScale =
dfPixHeight
The PCL driver for Windows supports five possible character translations. It
determines which internal translation table to use based upon the value of the
symbolSet member of the xtbl member. Following are the symbol sets and
their corresponding translation tables.
Symbol set | Translation table |
epsymECMA94 | ECMA94_Trans |
epsymGENERIC7 | GENERIC7_Trans |
epsymGENERIC8 | GENERIC8_Trans |
epsymRoman8 | Roman8_Trans |
epsymUSASCII | USASCII_Trans |
The translation tables are stored in the TRANS.H file. For epsymRoman8, epsymUSASCII, and epsymECMA94, the driver attempts to derive Windows ANSI from the symbol set. For epsymGENERIC8 and epsymGENERIC7, the driver simply lets an 8- or 7-bit symbol set pass through to the printer unchanged.
The driver assumes the width table in the PFM file contains the widths of the
characters after translation. If you set epsymRoman8, epsymUSASCII, or
epsymECMA94 for the symbolSet member of xtbl member, you must use the
appropriate translation table in TRANS.H to do an inverse translation when building the width table.
Following is a sample of the translation table for epsymRoman8:
#define HP_DF_CH ((BYTE) 0x7F)
unsigned char <+> Roman8_Trans[] = {
HP_DF_CH, NULL, /* 80 */
HP_DF_CH, NULL, /* 81 */
...
'Y' , 0xa8, /* dd */
0xf0, NULL, /* de */
0xde, NULL, /* df */
0xc8, NULL, /* e0 */
...
0xef, NULL }; /* ff */
The table translates characters in the range from 128 to 255. The driver uses the character it receives from the application to index into the translation table. It replaces the character with the first entry in the table. If the second entry is not a NULL entry, it overstrikes the first character with the second character.
For example, when the driver detects character 0xDD (that is, the Y-acute (Y)
in the text stream), the driver will output a capital “Y” overstruck by the acute
accent. When the overstrike character is present, the driver guarantees that the width of the character pair equals the width of the first character.
If the driver-specific data structure is not present, or the symbolSet member of xtbl member equals a symbol set other than epsymRoman8, epsymUSASCII, epsymECMA94, epsymGENERIC8, or epsymGENERIC7, the driver will use
the epsymGENERIC8 translation as a default if the dfLastChar member of the PFMHEADER structure is greater than 127 (an 8-bit font). Otherwise, it will use the epsymGENERIC7 translation.