Introduction

The Microsoft Windows Printers and Fonts Kit explains how to create files
that support the installation and use of printer and screen fonts for
Windows-based drivers. This book is intended to be used by:

o   Third-party font vendors who develop fonts for Hewlett-Packard Printer
    Control Language (PCL), Adobe PostScript(R), and other printers.

o   Cartridge manufacturers for printers that use PCL.

o   Printer manufacturers who have printers that support downloadable fonts
    or cartridges, and who want to make the font installation of their
    respective drivers consistent with other drivers.


Printer and Screen Fonts

The advances in desktop publishing and other computer endeavors have led to
an increase in the variety and quality of fonts available for printers. At
the same time, the need for quality screen fonts has grown and users expect
a reasonable approximation on the screen of what they plan to print. Since
the fonts used to print a document are rarely the same as the fonts used to
display the document on the screen, font vendors must supply screen fonts
that complement their printer fonts and information files that accurately
define the metrics (size and shape) of the printer fonts. When a user
installs the screen fonts and the metrics files, Microsoft(R) Windows(TM)
application can take advantage of the fonts to generate the best possible
WYSIWYG (what you see is what you get) display.


Windows Font Requirements

To ensure Windows applications can generate the best possible output, the
Windows environment must ultimately receive the following items for each
font:

o   The printer font, given as a printer-resident font, a downloadable
    font, or a cartridge.

o   A screen-font file in Windows .FON file format. The font must provide a
    reasonable approximation of the printer font while matching the aspect
    ratio of the display device.

o   A Printer Font Metrics (PFM) file or a Printer Cartridge Metrics (PCM)
    file suitable for the given Windows printer driver. The files must
    contain the metrics for the printer font, including font face,
    character widths, and pair- and track-kerning information.

The font vendor must make provisions to update the Windows initialization
file, WIN.INI, to make the display and printer drivers recognize these
fonts. Ideally, the printer driver will contain an installation program
that will read the font vendor's floppy disks, and install these files. In
the absence of such a utility, the font vendor should provide a
user-friendly installation program. Although Control Panel can install
screen fonts, installation of printer fonts and metrics files is too
specific for each device to allow for a generic installation program in
Windows.


Downloadable Fonts

Downloadable fonts (also called soft fonts) are the most cost-effective way
to distribute additional fonts for a printer device. This approach enables
third-party vendors to create and distribute downloadable soft fonts for a
device. Downloadable fonts also enable users to access a larger variety of
fonts than could be held in their printer's memory. This is possible
because the driver selectively downloads the fonts only when needed.

Each downloadable font must have a font file in printer-specific format.
This file is in the printer's font-command language. For the Windows
printer driver to download the file, it must know where the file resides on
the user's hard drive. Many Windows printer drivers use softfont settings
in the WIN.INI file to determine the font file locations.


Bitmap Screen Fonts

Font vendors should create bitmap screen fonts to accompany their printer
fonts. Screen fonts should be created for the aspect ratios of each of the
popular display device classes. Minimally, a vendor should supply line
sizes that match the frequently used graphic arts point sizes (that is, 8,
9, 10, 12, 14, 18, and 24). Screen fonts are measured in line sizes
(lines-per-inch) rather than typographic point sizes. Specific line sizes
of the fonts may be different from their nominal point sizes.


Metrics Files

Downloadable and cartridge fonts need Printer Font Metrics (PFM) and
Printer Cartridge Metrics (PCM) files. These files contain the same kind of
header information as Windows screen-font files, but also include extended
font metrics, kerning tables, and driver-specific information. A Windows
printer driver uses the information in a metrics file to prepare the width
and kerning tables used by the application during composition. A font
vendor must provide PFM files for downloadable fonts and PCM files for
cartridges.


Permanent and Temporary Downloadable Fonts

There are two forms of downloadable fonts:

o   Permanent Soft Fonts. These are copied from the computer to the printer
    when the printer is first turned on, and remain there until the printer
    is turned off. The Windows printer driver has access to permanent soft
    fonts for all the documents that it prints.

o   Temporary Soft Fonts. These are copied from the computer to the printer
    on an as-needed basis during the print job. They are deleted from the
    printer's memory at the end of a print job.

Settings in the WIN.INI file specify whether a downloadable font is
permanent or temporary. Furthermore, permanent fonts typically have a
corresponding batch file that copies the fonts to the printer when the
system first starts.


Downloadable and Cartridge-Font Installation

For the Windows printer driver to correctly locate downloadable or
cartridge fonts, the driver or a vendor-supplied utility must perform the
following operations:

o   Install the PFM, screen font, and downloadable font files by copying
    them from the font manufacturer's floppy disks to the user's hard drive.

o   Add the softfont or cartridge settings in the WIN.INI file.

Ideally, the softfont and cartridge settings in the WIN.INI file should be
set automatically by an installation program. Some Windows drivers, such as
the HP LaserJet printer driver that uses PCL, contain their own font
installation program. If the driver does not contain an installation
program, the font vendor should make every effort to provide an
installation program rather than direct the user to install the files
manually.

Chapter 1  Screen Fonts for Windows

Screen fonts provide a reasonable approximation of printer output on the
screen. Microsoft Windows applications that compose text for printers need
accurate screen fonts to ensure a WYSIWYG display. This means the screen
fonts must match the printer fonts as closely as possible. The more
accurate the representation, the more accurate the display. This chapter
presents the factors font vendors should consider when creating screen
fonts.


1.1 Aspect-Ratio Classes for Display Devices

Font vendors should create one set of screen fonts for each of the popular
aspect-ratio classes for displays. The aspect-ratio classes determine the
relative shape of pixels on the device, and therefore affect the design and
implementation of screen fonts. Windows recognizes two major aspect-ratio
classes.

Class          Typical device
---------------------------------------------------------------------------

1.33:1 (4:3)   The IBM Enhanced Graphics Adapter

1:1            The IBM PS/2 MCGA, VGA, and 8514/a

The actual dots-per-inch resolution is not a factor in determining the
class of the device; only the aspect ratio is used.


1.2 Translating Point Sizes into Line Sizes

Because of the variation in screen resolutions, screen font sizes are
discussed in terms of screen line sizes, not typographic point sizes. The
equation for relating point size to equivalent screen line size is as
follows:

                        text point size  * lines-per-inch
    screen line size =  --------------------------------------
                                        72
The lines-per-inch value specifies the logical page size for the device.
When possible, the lines-per-inch closely matches the physical size and
aspect ratio. The common screen lines-per-inch sizes for devices supported
by Windows are as follows:

o   For a 1:1 aspect ratio, 96:96 (VGA), 108:108, 120:120 (8514/a), and
    144:144

o   For a 4:3 aspect ratio, 96:72 (IBM Enhanced Graphics Adapter)

Since it is always better to select a smaller size when an exact match is
not possible, the quotient in the equation is truncated if the result is a
fractional line size.


1.3 Choosing the Correct Range of Line Sizes

To accurately represent a printer font on the screen, the font vendor must
make available a reasonable range of screen fonts. However, each screen
font uses memory. Therefore, a font vendor should carefully weigh
performance against a large screen-font variety.

The most important factor to consider when creating screen-font files is
memory use. Fewer and smaller screen fonts use less memory, but may degrade
the WYSIWYG quality of the display.

Other factors to consider include the following:

o   Legibility Threshold. There is a certain size at which the fonts are
    difficult, if not impossible, to read. For most screens, the value is 6
    lines. For high-resolution screens, the value is around 9-10 lines.
    Therefore, it does not make sense to provide fonts below these sizes.

o   Doubling and Tripling. The screen driver may double or triple a
    small-size font to take the place of an unavailable large font. For
    example, it may double an 18-line font to make a 36-line font, or it
    may triple a 24-line font to make a 72-line font. Doubling is not
    attractive, but acceptable and difficult to avoid. Tripling is
    unacceptable and can be avoided by providing a well-chosen range of
    screen line sizes.

o   Specific Applications. The application can control how the screen
    driver will select a font for such things as text greeking, doubling
    and tripling, vector font substitution, and downsizing to match widths.


1.4 Greeking

Some applications stop displaying screen fonts below a certain line size
and may display a gray shaded box or other graphic representation. This is
referred to as greeked text. Greeking speeds up the screen display.


1.5 Proof Versus Draft Quality

In Windows, proof usually means good, and draft means poor but quick. The
screen driver will never double or triple the size of a font for proof
quality. However, it will double or triple the size of smaller fonts to get
the exact size it wants for draft quality. If the correct size is
available, the screen driver will always choose it.

Doubling and tripling occur only when the exact size is not available. For
example, assume the only screen sizes are 10 and 19 lines, and the
application wants a 20-line screen font. In proof quality, the screen
driver would choose the 19-line font. In draft quality, the screen driver
would double the 10-line font.


1.6 Vector Font Substitution

Vector outline fonts are not as attractive as raster screen fonts, but they
look better than doubled or tripled screen fonts. Also, the amount of
memory used by vector fonts is constant while the amount of memory used by
raster fonts increases as the font size increases.


1.7 Downsizing to Match Widths

When the screen fonts do not accurately represent the printer fonts (that
is, the height-to-width ratio of the printer font is different from that of
the screen font), an application can request a smaller font to get the
correct width. The application can display the line more quickly and
prevent the characters from overlapping using this method.

This behavior can most often be observed when the font vendor does not
supply matching screen fonts, or the screen fonts do not contain the same
height-to-width ratio as their corresponding printer fonts.


1.8 Recommended Screen-Font Sizes

Nothing produces an accurate display representation than a wide range of
screen font sizes. On the other hand, nothing affects system performance
faster than a large number of screen fonts. Therefore, the selection of
screen fonts must balance desired display quality with system performance.

For example, consider two computers with different screen-font
configurations. Computer A contains the screen font sizes 7, 10, and 16
lines. Computer B contains the sizes 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, and 18 lines. If the user creates a page using all the fonts from
Computer B, the differences in sizes will be visible. However, the computer
will load 12 screen fonts to display the page.

On Computer A, with doubling and tripling capabilities disabled, the
computer displays the same range of sizes as follows:

o   7, 8, and 9 lines displayed with the 7-line font

o   10, 11, 12, 13, 14, and 15 lines displayed with the 10-line font

o   16, 17, and 18 lines displayed with the 16-line font

Much of the WYSIWYG would be lost because several sizes are displayed with
the same font. However, the computer only loaded three fonts to display the
page.

Computer B slowly displayed high quality, while Computer A quickly
displayed poor WYSIWYG quality.

A font vendor needs to consider the application the user will run with
Windows. For example, Microsoft Excel generally uses body-size fonts (fonts
in the size range of 8 to 12 points). Therefore, a wide range of font sizes
is unnecessary. And Aldus PageMaker, although it uses a large range of
sizes, switches to vector fonts above 24 lines (that is, the default Vector
text above setting).

Ideally, the user should decide which is more important: display quality or
performance. Many font products contain a font generator that requires the
user to specify which point sizes to build. For such programs, the user
should be given the option to select a predetermined range of sizes.

Range         Sizes
---------------------------------------------------------------------------

Publishing    8, 9, 10, 12, 14, 18, and 24 lines.

Artwork       7, 8, 9, 10, 11, 12, 14, 16, 18, 21, 24, 28, and 32 lines.

General use   8, 10, 12, 18, and 24 lines.

If the font-creation program requires the user to indicate exactly which
sizes should be built (that is, there are no predetermined ranges), then
the documentation should provide specific instructions on what numbers to
enter, based upon the user's needs, or intended use for the product.

For font packages that give the user no choice in the size range, the
vendor should supply the Publishing size range of 8, 9, 10, 12, 14, 18, and
24 lines.

Chapter 2  Metrics File Formats

Microsoft Windows printer drivers provide lists of the fonts available on
the printer. Although most drivers have the text metrics for a few
device-resident fonts built in as resources, the majority of the
printer-font metrics are external to the drivers and are in the form of
Microsoft Windows printer font metrics files. This chapter describes the
format of the font metrics files for Windows printer drivers.


2.1 Printer Font Metrics Files

A printer font metrics (PFM) file has the following general form:

    PFMHEADER       Header;          /* font header */
    WORD            WidthTable[];    /* character widths */
    PFMEXTENSION    Extensions;      /* extensions */
    char            DeviceName[];    /* printer-device name */
    char            FaceName[];      /* font name */
    EXTTEXTMETRIC   ExtTextMetrics;  /* extended-text metrics */
    WORD            ExtentTable[];   /* unscaled-character widths */
    DRIVERINFO      DriverInfo;      /* driver-specific information */
    PAIRKERN        KerningPairs[];  /* pair-kerning table */
    KERNTRACK       KerningTracks[]; /* track-kerning table */
The PFMHEADER structure, the PFMEXTENSION structure, and font name must be
present in every PFM file. Whether a PFM file contains any of the other
structures and arrays depends on the printer driver and the font vendor's
preferences.

The PFMHEADER and PFMEXTENSION structures must be, respectively, the first
and second structures in the file. The remaining structures and arrays may
appear in any order. Their locations are indicated by the offsets in the
PFMHEADER and PFMEXTENSION structures.

The following sections describe the arrays in the file, such as the width
table. For more information about the structures, see Section 2.4,
Structure Reference, later in this chapter.


2.1.1 Width Table

The width table in the PFM file is an array of 16-bit values containing the
width of each character in the font. The number of elements in the array is
computed as dfLastChar - dfFirst + 2. Since the last entry is extra, it is
set to zero.

The width table is optional. For example, fixed-pitch fonts do not require
the table since all characters have the same width. If the table is
provided, it must be placed between the PFMHEADER and PFMEXTENSION
structures.


2.1.2 Device and Font Names

The device and font names are null-terminated strings specifying the name
of the printer device and font face, respectively.


2.1.3 Extent Table

The extent table is an array of 16-bit values containing the width of each
character in the font at the default point size.


2.2 Printer-Cartridge Metrics Files

A printer-cartridge metrics (PCM) file has the following general form:

    PCMHEADER   Header;             /* font header           */
    char        CartridgeTitle[];   /* title for cartridge   */
    BYTE        PFMFiles[];         /* an array of PFM files */
The PCMHEADER structure contains information about the PCM files, such as
its size and the location of the cartridge title. For more information
about structures, see Section 2.4, Structure Reference later in this
chapter.

The PCMHEADER structure must contain a nonzero offset to the cartridge
title. This string must be nonempty and null-terminated. This title is used
in the cartridge list box in the Printer Setup dialog box.

The PCM file must contain one PFM file for each font in the cartridge. The
files must be appended together. Since each PFM file contains its own size
in bytes, the location of each PFM file is calculated as an offset from the
previous PFM file. All file positions in a PFM file itself are offsets from
the beginning of the individual PFM file and the PCM file.


2.3 Font Scaling: etmMasterHeight and etmMasterUnits

Printer drivers use the values in the etmMasterHeight and etmMasterUnits
members of the EXTTEXTMETRIC structure to scale the character width values
in the extent table. A driver allows two methods for measuring character
widths:

o   Device units or pixels

o   Font units

Device units are the number of dots in the physical device (dots-per-inch);
etmMasterHeight is expressed in device units. It may be converted to points
using the formula:

                       etmMasterHeight device units * 72 points-per-inch
    height in points = ---------------------------------------------------
                               dfVertRes device units-per-inch
In this case, 72 represents the number of points-per-inch. The dfVertRes
member contains the number of dots-per-inch in device units.

Font units may differ from device units as a convenience to the font
vendor. If the font is intended for devices that differ in resolution,
there typically is no benefit from mapping the resolution of the font to
the resolution of a particular printer. The vendor uses the units that are
most convenient for designing the font. For example, 1000 units-per-cell
(or em) is the Adobe standard for PostScript fonts; etmMasterUnits is
expressed in font units-per-em where an em equals etmMasterHeight.

A number may be converted from device units to font units using the
formula:


    value in font units =
             value in device units * etmMasterUnits font units
             -------------------------------------------------
                       etmMasterHeight device units

The formula for the inverse operation is:


    value in device units =
             value in font units * etmMasterHeight device units
             --------------------------------------------------
                      etmMasterUnits font units

2.3.1 Determining Character Widths

The values in the extent table are the widths of the characters when the
font height equals etmMasterHeight. When the font height does not equal
etmMasterHeight, the driver must scale the values from the extent table.
Always assume linear scaling fonts.

The values in the extent table are in font units. The width of a character
for a particular font height may be computed as follows:


    character width      value from extent table in font units
    ---------------   =  -------------------------------------
      fontheight            etmMasterUnits font units
By multiplying font height through the equation, we have the formula for
computing character width:

                      font height * value from extent table in font units
    character width = ---------------------------------------------------
                                   etmMasterUnits font units
Character width takes on the units of font height. If the font height is in
device units, the resulting width will be in device units. If the font
height is in font units, the resulting width will be in font units.

In its normal mode of operation, the driver simply plugs the font height
into the above equation to compute the character width. Font height is
normally in device units, so the resulting width is normally in device
units.

For example, assume the device resolution is 300 dpi and the font units are
expressed as 1000 units-per-em. Assuming that the etmMasterHeight member
represents a 72-point font, the values would look like this:

dfVertRes = 300

etmMasterHeight = 300

etmMasterUnits = 1000

Additionally, assume the value in the width table for a capital H is 500
font units, or half the em height. Assume the height of the font for which
you want the character width is 12 points, or 50 device units. With
relative widths disabled, the character width would be computed using the
first width formula:

    50 device units * 500 font units
    --------------------------------  = 25 device units
         1000 font units

2.3.2 Using the ENABLERELATIVEWIDTHS Escape

When the application calls the ENABLERELATIVEWIDTHS escape, the driver
expects the application to request a font height in device units, but will
return the character width in font units. The application may want to
obtain widths in font units to alleviate any error that may result from
rounding widths to device units. It is the responsibility of the driver to
correct this error when relative widths are disabled, but the application
may choose to enable relative widths and perform its own error correction.

The driver converts the font height (in device units) to font units prior
to computing the character width. The resulting formula is:

    character width in font units =
         font height in device units * character extent in font units
         ------------------------------------------------------------
                         etmMasterHeight device units
This formula was computed by replacing the font height from the first
formula for character width with the formula for converting a value from
device units to font units, and then simplifying the equation.

Using the same assumptions provided in the previous section, you can now
work through some more examples. You know that the width of the character
is 25 device units (that is, dots or pixels) or half the height of 50
device units. With relative widths enabled, the character width would be
computed using the second width formula:

    50 device units * 500 font units
    -------------------------------- = 83.333 font units
        300 device units
The width of the character is 83.333 font units. The driver will round
noninteger results.

To demonstrate that the width in font units is equivalent to the width in
device units, it can be converted to device units using the formula
provided in the previous section:

    83.333 font units  * 300 device units
    ------------------------------------- = 25 device units
       1000 font units
For more information about the restrictions imposed by drivers, see Chapter
3, The PFM Editor, and Chapter 4, PCL/HP LaserJet Printer Driver.


2.4 Structure Reference

The following is an alphabetical listing of the structures used in PFM and
PCM files.

DRIVERINFO

    typedef struct tagDRIVERINFO {
        WORD epSize;      /* size of this data structure */
        WORD epVersion;   /* number indicating structure version */
        DWORD epMemUsage; /* amount of memory font takes up in printer */
        DWORD epEscape;   /* pointer to escape that selects the font */
        TRANSTABLE xtbl;  /* character-set translation information */
    } DRIVERINFO;
The DRIVERINFO structure contains information that is specific to the given
device. The structure described here is intended to be used in PFM file for
the HP LaserJet printer driver that uses Printer Control Language (PCL).


Members

   epSize
   Specifies the size of this structure (number of bytes).

   epVersion
   Specifies the version of this structure, currently 1.

   epMemUsage
   Specifies the amount of printer memory (in bytes) that this font uses.

   epEscape
   Specifies the byte offset from the beginning of the file to an escape
   string calling the font.

   xtbl
   Specifies a TRANSTABLE structure containing character-translation data.



EXTTEXTMETRIC

    typedef struct{
        short etmSize;
        short etmPointSize;
        short etmOrientation;
        short etmMasterHeight;
        short etmMinScale;
        short etmMaxScale;
        short etmMasterUnits;
        short etmCapHeight;
        short etmXHeight;
        short etmLowerCaseAscent;
        short etmUpperCaseDescent;
        short etmSlant;
        short etmSuperScript;
        short etmSubScript;
        short etmSuperScriptSize;
        short etmSubScriptSize;
        short etmUnderlineOffset;
        short etmUnderlineWidth;
        short etmDoubleUpperUnderlineOffset;
        short etmDoubleLowerUnderlineOffset;
        short etmDoubleUpperUnderlineWidth;
        short etmDoubleLowerUnderlineWidth;
        short etmStrikeOutOffset;
        short etmStrikeOutWidth;
        WORD  etmKernPairs;
        WORD  etmKernTracks;
    }EXTTEXTMETRIC;
The EXTTEXTMETRIC structure provides extended-metric information for a
font. All the measurements are given in the specified units, regardless of
the current mapping mode of the display context.


Members

   etmSize
   Specifies the size of this structure (in bytes).

   etmPointSize
   Specifies the nominal point size of this font in twips (twentieths of a
   point). This is the intended graphics art size of the font; the actual
   size may differ slightly depending on the resolution of the device.

   etmOrientation
   Specifies the font's orientation. It can be one of the following values.

    Value   Meaning
    -----------------------------------------------------------------------

    0       Either orientation.

    1       Portrait.

    2       Landscape.

   This value refers to the ability of this font to be imaged on a page of
   the given orientation. Landscape pages are those whose width
   (x-dimension) is greater than their height (y-dimension).

   etmMasterHeight
   Specifies the font size in device units for which the values in this
   font's extent table are exact.

   etmMinScale
   Specifies the minimum valid size for a given font (in device units).

                                  etmMinScale * 72
            smallest point size = ----------------
                                      dfVertRes
   In this example, 72 represents the number of points-per-inch. The
   dfVertRes member contains the number of dots-per-inch.

   etmMaxScale 
   Specifies the maximum valid size for a given font (in device units).

                                 etmMaxScale * 72
            largest point size = ----------------
                                    dfVertRes
   In this example, 72 represents the number of points-per-inch. The
   dfVertRes member contains the number of dots-per-inch.

   etmMasterUnits
   Specifies the integer number of units-per-em where an em equals
   etmMasterHeight. In other words, the etmMasterHeight member is expressed
   in font units rather than device units.

   etmCapHeight
   Specifies the height of uppercase characters for a given font (in font
   units). Typically, H is used for the measurement purposes.

   etmXHeight
   Specifies the height of lowercase characters for a given font (in font
   units). Typically, x is used for the measurement purposes.

   etmLowerCaseAscent
   Specifies the distance (in font units) that the ascender of lowercase
   letters extends above the baseline. This distance is typically specified
   for a lowercase d.

   etmLowerCaseDescent
   Specifies the distance (in font units) that the descender of lowercase
   letters extends below the baseline. This distance is typically specified
   for a lowercase p.

   etmSlant
   Specifies the angle in tenths of degrees clockwise (to the right) from
   the upright version of the font (assuming this font is slanted or
   italicized).

   etmSuperScript
   Specifies the recommended amount (in font units) to offset superscript
   characters from the baseline. This amount is typically specified by a
   negative offset.

   etmSubScript
   Specifies the recommended amount (in font units) to offset subscript
   characters from the baseline. This amount is typically specified by a
   positive offset.

   etmSuperScriptSize
   Specifies the recommended size (in font units) of superscript characters
   for this font.

   etmSubScriptSize
   Specifies the recommended size (in font units) of subscript characters
   for this font.

   etmUnderlineOffset
   Specifies the offset (in font units) downward from the baseline where
   the top of a single underline bar should appear.

   etmUnderlineWidth
   Specifies the thickness (in font units) of the underline bar.

   etmDoubleUpperUnderlineOffset
   Specifies the offset (in font units) downward from the baseline where
   the top of the upper, double underline bar should appear.

   etmDoubleLowerUnderlineOffset
   Specifies the offset (in font units) downward from the baseline where
   the top of the lower, double underline bar should appear.

   etmDoubleUpperUnderlineWidth
   Specifies the thickness (in font units) of the upper, double underline
   bar.

   etmDoubleLowerUnderlineWidth
   Specifies the thickness (in font units) of the lower, double underline
   bar.

   etmStrikeOutOffset
   Specifies the offset (in font units) upward from the baseline where the
   top of a strikeout bar should appear.

   etmStrikeOutWidth
   Specifies the thickness (in font units) of the strikeout bar.

   etmKernPairs
   Specifies the number of character-kerning pairs defined for the given
   font. You can use this value to calculate the size of the pair-kern
   table returned by the GETPAIRKERNTABLE escape. It will not be greater
   than 512 kern pairs.

   etmKernTracks
   Specifies the number of kerning tracks defined for the given font. You
   can use this value to calculate the size of the track-kern table
   returned by the GETTRACKKERNTABLE escape. It will not be greater than 16
   kern tracks.



PCMHEADER

    typedef struct _PCMHEADER {
        WORD pcmMagic;
        WORD pcmVersion;
        DWORD pcmSize;
        DWORD pcmTitle;
        DWORD pcmPFMList;
    } PCMHEADER;
The PCMHEADER structure contains information about the PCM file.


Members

   pcmMagic
   Contains the magic number 3244 (0x0CAC). The Printer Font Installer uses
   it to recognize PCM files when no FINSTALL.DIR file is supplied with the
   PCM file.

   pcmVersion
   Contains the version number of the PCM file. The upper byte contains the
   version number and the lower byte the revision number, both in BCD.

   pcmSize
   Contains the size (in bytes) of the entire PCM file.

   pcmTitle
   Specifies the offset from the beginning of the file to the title string
   for the cartridge.

   pcmPFMList
   Specifies the offset from the beginning of the file to the first PFM.



PFMEXTENSION

    typedef tagPFMEXTENSION {
        WORD  dfSizeFields;
        DWORD dfExtMetricsOffset;
        DWORD dfExtentTable;
        DWORD dfOriginTable;
        DWORD dfPairKernTable;
        DWORD dfTrackKernTable;
        DWORD dfDriverInfo;
        DWORD dfReserved;
    } PFMEXTENSION;
The PFMEXTENSION structure contains extended information for printer fonts.


Members

   dfSizeFields
   Specifies the size (in bytes) of this structure.

   dfExtMetricsOffset
   Specifies the byte offset in the file to the EXTTEXTMETRIC structure for
   the given font.

   dfExtentTable
   Specifies the byte offset in the file to the extent table. The size of
   the table is dfLastChar - dfFirstChar + 1 WORD. The extent table
   contains the unscaled widths (in 1/1000's of an em) of the characters in
   the font.

   dfOriginTable
   Specifies the byte offset in the file to the table of character origins.
   The size of the table is dfLastChar - dfFirstChar + 1 WORD. For
   screen-font files, this table gives the signed amount of left adjustment
   to add to the current position before drawing the characters. Negative
   values indicate left movement; positive values indicate right movement.
   This should be NULL for PFM files.

   dfPairKernTable
   Specifies the byte offset in the file to the optional pair-kerning table
   should be NULL if no kerning pairs are defined for this font. The size
   of the table is given by the etmKernPairs member of the EXTTEXTMETRIC
   structure.

   dfTrackKernTable
   Specifies the byte offset in the file to the optional track-kerning
   table. This should be NULL if no kerning tracks are defined for this
   font. The size of the table is given by the etmKernTracks member of the
   EXTTEXTMETRIC structure.

   dfDriverInfo
   Specifies the byte offset in the file to additional driver-specific
   information. Each driver writer is responsible for documenting the
   format of the data pointed to by this member. These formats will be made
   public so that third parties that want to create compatible printer font
   metrics files may do so.

   dfReserved
   Reserved; must be zero.



PFMHEADER

    typedef struct PFMHEADER {
        WORD  dfVersion;
        WORD  dfSize;
        char  dfCopyright[60];
        WORD  dfType;
        WORD  dfPoints;
        WORD  dfVertRes;
        WORD  dfHorizRes;
        WORD  dfAscent;
        WORD  dfInternalLeading;
        WORD  dfExternalLeading;
        BYTE  dfItalic;
        BYTE  dfUnderline;
        BYTE  dfStrikeOut;
        WORD  dfWeight;
        BYTE  dfCharSet;
        WORD  dfPixWidth;
        WORD  dfPixHeight;
        BYTE  dfPitchAndFamily;
        WORD  dfAvgWidth;
        WORD  dfMaxWidth;
        BYTE  dfFirstChar;
        BYTE  dfLastChar;
        BYTE  dfDefaultChar;
        BYTE  dfBreakChar;
        WORD  dfWidthBytes;
        DWORD dfDevice;
        DWORD dfFace;
        DWORD dfBitsPointer;
        DWORD dfBitsOffset;
    } PFMHEADER;
The PFMHEADER structure contains the information about a Windows raster or
vector font. The PFMHEADER structure is identical to the Windows 2.x
FONTINFO structure. The PFMHEADER structure is also identical to a
font-file header. For more information about the FONTINFO structure, see
the Microsoft Windows Device Driver Adaptation Guide.



SYMBOLSET

    typedef enum{
        epsymUserDefined,
        epsymRoman8,
        epsymKana8,
        epsymMath8,
        epsymUSASCII,
        epsymLineDraw,
        epsymMathSymbols,
        epsymUSLegal,
        epsymRomanExt,
        epsymISO_DenNor,
        epsymISO_UK,
        epsymISO_France,
        epsymISO_German,
        epsymISO_Italy,
        epsymISO_SwedFin,
        epsymISO_Spain,
        epsymGENERIC7,
        epsymGENERIC8,
        epsymECMA94
    } SYMBOLSET;
The SYMBOLSET structure enumerates all supported symbol-set values.



TRANSTABLE

    typedef struct tagTRANSTABLE {
        SYMBOLSET symbolSet;        /* kind of translation table */
        DWORD offset;               /* location of user-defined table */
        WORD len;                   /* length (in bytes) of table */
        BYTE firstchar,lastchar;    /* table range */
    } TRANSTABLE;
The TRANSTABLE structure contains information needed to translate font
characters from the character set specified by the dfCharSet member into
the printer-specific character set.


Members

   symbolSet
   Specifies the symbol-set identifier, such as epsymRoman8 or epsymECMA94.

   offset
   Specifies the byte offset from beginning of the file to a
   custom-translation table.

   len
   Specifies the size of the custom-translation table.

   firstchar
   Specifies the first character translated in the table.

   lastchar
   Specifies the last character translated.


Comments

When the symbolSet member of the xtbl member equals epsymUserDefined, the
driver uses the custom-translation table pointed to by the offset member of
the xtbl member. However, the Windows PCL driver currently ignores all
members in the TRANSTABLE structure except the symbolSet member of the xtbl
member. In other words, even if a custom-translation table is put in for
future support, the current driver ignores it.

Chapter 3  The PFM Editor

The Printer Font Metrics (PFM) Editor is a Microsoft Windows application
that a font vendor can use to create and edit PFM files and create Printer
Cartridge Metrics (PCM) files for Hewlett-Packard printers and printer
drivers that use Printer Control Language (PCL). The PFM Editor simplifies
and accelerates the task of creating PFM files by not requiring a great
deal of knowledge about either the PFM file format or Windows device
drivers. The PFM Editor allows developers with some font experience to
create the information file needed by the driver to support the cartridge.

The PFM Editor reads the filename of a PFM file from the command line in
the WIN.INI file. Thus, defining the PFM extension in WIN.INI allows the
user to double-click PFM files to edit them.


3.1 The Main Window

The main window of the PFM Editor contains several fields that give general
identifying information about the font. All of these members appear in the
PFMHEADER structure.

You should always specify at least the Pitch member before selecting any of
the metrics or dialog boxes described in the following sections.

The following members appear in the main window.

Member        Description
---------------------------------------------------------------------------

Font Name     The name of the font, such as Courier(R).

Char Set      The character set the font represents. It can be one of the
              following values.

           Value   Meaning
           ----------------------------------------------------------------

           0       Windows ANSI

           180     Math-8 (PCL driver only)

           181     PI Font (PCL driver only)

           182     LineDraw (PCL driver only)

           183     PC Line (PCL driver only)

           184     Tax Line (PCL driver only)

           185     US Legal (PCL driver only)

           255     OEM character set

Pitch         Two selections: Fixed and Proportional.

Effects       Three selections indicating the appearance of the font:
              Italic, Underline, Strikeout.

Font Family   Six selections: Don't Care, Roman, Swiss, Modern, Script, and
              Decorative. The driver uses the family to classify fonts for
              identification and selection purposes.

Points        The point size of a font, or its height in units of 1/72 of
              an inch.

Weight        The weight of the font minus a number from 0 to 1000. 400
              represents a normal, medium font. Larger numbers represent
              bold fonts.

Copyright     A 60-character string containing the font supplier's
              copyright notice.


3.2 The File Menu

The File menu contains all the standard Windows File menu commands along
with one extra command: Create PCM File. The following is a list with
descriptions of those commands.

Command           Description
---------------------------------------------------------------------------

New               Causes the PFM Editor to reinitialize itself, and display
                  an empty, untitled PFM file.

Open              Displays a standard Open File Name dialog box. PFM is the
                  default file extension.

Save              Saves the PFM file with the same name as previously used
                  in a Load or Save operation. If the file is untitled, the
                  Save As dialog box appears.

Save As           Allows the user to specify a filename before saving.

Create PCM File   Allows the user to create a cartridge-metrics file for
                  the PCL driver.

Exit              Exits the PFM Editor.

About             Displays an informational dialog box.

As with all applications, the user is given the opportunity to save or
cancel if the New, Open, or Exit commands are chosen when the current file
has been saved, but not changed.


3.3 The Metrics Menu

The Metrics menu allows you to activate dialog boxes to specify dimensional
information about the font. The Metrics popup menu contains three options:
Basics, Extended, and Effects.

Basic metrics includes information about character-range heights and such
things as average widths, device resolution, and leading.

Extended metrics is detailed information about the geometry of the font,
including such things as baseline, ascents and descents, orientation,
scale, and so on.

Effects metrics is information about how to synthesize effects such as
underlining and strikeout. To get to this dialog box, you must first go
through the Extended Metrics dialog box.


3.3.1 The Basic Metrics Dialog Box

From the Metrics menu, choose the Basics command to display the Basic
Metrics dialog box. It contains information about font size. The dialog box
contains the following text boxes.

Text box                  Description
---------------------------------------------------------------------------

Characters                The first character in the character set. This is
First                     the numeric character code of the first character
                          for which the font contains a printable character.

Last                      The last character in the character set. This is
                          usually 127 for a 7-bit character set, or 255 for
                          an 8-bit character set.

Default                   The code of the character printed if the driver
                          is asked to print a character that falls outside
                          the range First through Last.

Break                     The character that delimits words in word
                          wrapping. If an application or the DrawText
                          function is asked to wrap a string in a box, it
                          will break the string into multiple lines only at
                          break character positions. This is generally the
                          space character (32 in both ANSI and ASCII).

Leading                   The leading that appears within the height
Internal                  specified by the height of the font. Diacritical
                          marks appear in this space.

External                  The recommended additional space to insert
                          between lines. This space is not already
                          accounted for in the height of the font.

Resolution                The number of dots-per-inch at which the font was
Horizontal and Vertical   digitized. For an HP LaserJet, for example, both
                          of these numbers should be 300.

Widths                    For proportional space fonts, the average width
Average                   of all the characters in the font. This box is
                          relabeled All for fixed-pitch fonts, because all
                          fixed-pitch characters have the same width. It is
                          represented in font units. The PFM Editor does
                          not calculate the average width from the width
                          table; it must be explicitly entered. It is
                          generally the width of the lowercase x.

Maximum                   The width in font units of the widest character
                          in the font. Again, this is not calculated from
                          the user-width table. For fixed-pitch fonts, this
                          box is not used and is disabled.

Height                    The height in font units of the character cell,
                          including internal leading.

Ascent                    The ascent in font units of the font. The
                          distance from the top of the character cell to
                          the baseline of the font.

With the exception of the width table for proportional fonts, this dialog
box fills in the remainder of the Microsoft-defined font file header. All
of these text boxes must be specified accurately.

There are also two buttons: OK, which carries out the changes in the PFM
file, and Cancel, which ignores all changes made.


3.3.2 The Extended Metrics Dialog Box

The extended font metrics are a more detailed description of the font's
geometry. The dialog box contains the following text boxes.

Text box                 Description
---------------------------------------------------------------------------

Lower Case               The distance in font units from the baseline to
Ascent                   the top of lowercase ascenders, typically measured
                         from the lowercase d.

Descent                  The distance in font units from the baseline to
                         the bottom of descenders, usually specified for
                         lowercase p.

Point Size               The intended size of the font in twips (1/20th of
                         a point, or 1/1440 of an inch).

Cap Height               The height in font units of the font's uppercase
                         characters, usually taken for the character H.

X Height                 The height in font units of lowercase characters,
                         usually the height of the lowercase x.

Slant                    The angle in tenths of a degree clockwise from the
                         vertical.

Master Height            The size in device units at which the values in
                         the extent table are exact.

Master Units             The Master Height text expressed in font units. If
                         the two are different, then the device is a linear
                         scaling device, and the application needs to scale
                         all values by the ratio of the requested size to
                         this value.

Scale                    The minimum and maximum sizes to which a linear
Min and Max              scaling device can scale a font.

Orientation              The orientation of the font, which may be either
Portrait and Landscape   or both.

The Master Height, Master Units, and Min and Max Scale boxes are used on
devices that can scale fonts linearly to any size. On devices that do not
scale fonts, these numbers should all be equal to the value in the Height
box from the Basic Metrics dialog box.

All these members come from the EXTTEXTMETRIC structure.


3.3.3 The Effects Metrics Dialog Box

This menu item is disabled (grayed) until you specify the extended metrics.
The information you can then specify in this dialog box tells the driver
how to synthesize effects such as underlining and superscripting, while
allowing for the per-font, per-size customization of these effects. It also
forms the remainder of the EXTTEXTMETRIC structure in the PFM file.

Superscripting, subscripting, underlining, double underlining, and
strikethroughs require two numbers. The vertical position of the effect and
its size. Offsets are measured downward from the baseline of the font,
which means that strikeouts and superscripts will generally have negative
offsets. The size specifies the thickness of lines in font units for the
line effects, or the height in font units for superscripts and subscripts.
For double underlines, you may specify the upper and lower lines
independently.


3.4 The Tables Menu

This popup menu contains three selections: Widths, Kerning Pairs, and
Kerning Track. Since these are only appropriate for proportional-width
fonts, they are disabled for fixed-pitch fonts.

The width table contains the exact specification, per-character, of the
widths of characters in proportional fonts. Track- and pair-kerning are
used to fine-tune character spacing.


3.4.1 The Width Table Dialog Box

The Width Table dialog box has a scrollable list box containing all the
characters and their widths, represented by decimal numbers in font units.
Notice that, since this table is an absolute requirement for all
proportional fonts, you must set the font pitch to proportional and the
first and last characters in the Basics dialog box before entering a width
table.

Just above the list box is a label number with an edit control next to it.
Whenever a character is selected from the list box, the label changes to
the character's code, and the edit control is changed to its width. The
width can then be changed.

To change the width of a character in the width table in the list box, you
must choose the Width button. If the character is not the last one in the
font, choosing the Width button, or pressing the ENTER key also causes the
selection to be advanced to the next character, which enables you to
quickly enter the entire width table.


3.4.2 The Pair Kerning Table Dialog Box

You can fine-tune character spacing for proportional fonts by using
pair-kerning. The Pair Kerning Table dialog box consists of a list box
containing character pairs and the amount of space to insert or delete
between them. A negative kern amount (given in font units) specifies
tighter spacing, while a positive amount spreads characters out.

The three edit controls are for the From and To characters and the kerning
amount. If you select a kern pair in the list box, the editor displays the
values in the structure for modification.

There are three buttons for manipulating the Pair Kerning Table:

o   Add, which adds the kern pair to the table in the edit controls.

o   Delete, which removes the selected kern pair from the list box.

o   Change, which replaces the selected kern pair with the contents of the
    edit control.

The Pair Kerning Table is sorted; adding or replacing a pair does not give
it a particular position in the table.

As in the other dialog boxes, the OK button carries out the changes in the
PFM file, and the Cancel button ends the dialog without saving the changes
to the table.


3.4.3 The Track Kerning Table Dialog Box

You type values into the Track Kerning Table in the same manner as for the
Pair Kerning Table. There are five text boxes to consider.

For the kerning degree, negative values specify tighter kerning, and
positive values specify looser kerning. The minimum size specifies the
smallest size in font units for which track kerning applies, and the
maximum size specifies the largest font.

The minimum amount specifies the amount of track kerning to apply to fonts
of the minimum size and below. The maximum amount is the track kerning to
apply to all fonts at least as large as the maximum size.


3.5 The Driver Menu

The PCL printer is currently the only supported printer in the Driver menu.
The PCL Driver dialog box contains information specific to the PCL driver
for HP LaserJet-type printers. The text boxes are as follows.

Text box        Description
---------------------------------------------------------------------------

Symbol Set      Specifies the HP-defined symbol set for a font. (For more
                information about the symbol sets, see the Hewlett-Packard
                LaserJet Printer documentation.) The following are the
                currently defined symbol sets (selected with individual
                buttons):

                 E.C.M.A. 94
                 Generic 7
                 Generic 8
                 ISO Den/Nor
                 ISO France
                 ISO Germany
                 ISO Italy
                 ISO Spain
                 ISO Sweden/Finland
                 ISO U.K.
                 Kana 8
                 Line Draw
                 Math 8
                 Math Symbols
                 Roman 8
                 Roman Ext.
                 U.S. ASCII
                 U.S. Legal
                 User Defined
Mem Usage       An approximation of the amount of memory in the printer
                that the soft font requires. This is given as the following
                formula:

                 ((sum of all character widths + 7)>> 3) * height + 63
Escape String   This is the escape string you send to the printer to select
                the font. It may contain any PCL commands. You may use the
                following special sequences to type control characters:

                 \e - escape (ASCII 27, 0x1b)
                 \[ - escape (ASCII 27, 0x1b)
                 \n - line feed (ASCII 10, 0xa)
                 \r - carriage return (ASCII 13, 0xd)
                 \xnn - hexadecimal character code
                 \nnn - octal character code
                When the PFM Editor displays an escape string, it converts
                all non-ASCII printing characters to the hexadecimal format
                \xnn.

As in the other dialog boxes, the OK button carries out the changes in the
PFM file, and the Cancel button ends the dialog without saving changes.


3.6 Creating PCM Files

The PCL driver uses Printer Cartridge Metric (PCM) files to define
cartridges other than built-in Hewlett-Packard cartridges. PCM files are
essentially a collection of PFM files (one for each font in the cartridge).

To make a PCM file, you must first create the individual PFM files for each
of the cartridge fonts. You can create PFM files easily with the Printer
Font Installer. Simply add the font, which must be in the Hewlett-Packard
PCL format. The Printer Font Installer will automatically scan the PCL font
and create the PFM file. Use the PFM Editor to edit the file. Verify all
the boxes and values. Also, notice that the Printer Font Installer does not
enter the font escape string. You must do this with the PFM Editor.

After you have created all the PFM files and saved them in one directory,
from the File menu, choose the Create PCM File command to display a dialog
box and prompt you for a PCM filename. Put this file in the same directory
as its constituent PFM files.

After you type a filename and choose the OK button, a second dialog box
appears with the PCM filename in a static control at the top. The first
edit control in the dialog box enables you to enter the cartridge title,
which must be a nonempty title (that is, you must fill in the edit
control). This title is the string placed in the cartridge selection list
box in the driver's Printer Setup (device-mode) dialog box. Verify that the
correct font escape string is defined for each PFM file.

The PFM Editor places a list of PFM files, that are in the same directory
as the target PCM file, in a list box on the left side of the dialog box.
You can select one or more of these files and move them to the right-hand
selected list box by choosing the Select button (or double-clicking a
filename). You can remove selected PFM files, or place them back in the
left-hand available list box by selecting filenames in the same manner in
the right-hand selected list box.

When you choose the OK button, the PFM files that appear in the right-hand
list box are placed in the PCM file. To create the PCM file, you must
select at least one PFM file and have a nonempty title string.

When the editor creates the PCM file, it also creates a text file in the
same directory with the same name and the .INI extension. On the first line
of this initialization file is the title of the cartridge; the list of PFM
files follows on subsequent lines, one filename per line. Whenever the PCM
dialog box is chosen, the PFM Editor looks for the .INI file and uses the
stored data to initialize the title string and the list of selected PFM
files.

NOTE  Editing a PFM file will not cause the PCM file to be updated. The PFM
Editor cannot directly edit PCM files. Therefore, if you make a change in a
PFM file, you must rebuild the PCM file.


3.7 Converting PFM Files for Minidrivers

If you want to use a file you've created with the PFM Editor with
minidrivers, you'll need to convert the file using the CVTHPPFM utility.
You run this utility from the MS-DOS command line.

Additionally, if you want to convert 3.1 PFM files to use with 3.0 PFM
files, you can use the CVTHPPFM utility to perform this conversion as well.


3.8 The PFM Editor Error Messages

The following error messages can appear when using the PFM Editor. A brief
explanation of why the message appears is given after each message.

Break character not in character set

The break character must be between the first and last character in the
character set, inclusive.

Can't find filename, ignored

The initialization file for a PCM file contained a reference to a PFM file
that is not in the same directory, or that does not have the .PFM
extension.

Can't open filename, ignored

The specified PFM file was in the current directory when the list box of
available PFM files was created. However, when the attempt to write the PCM
file was made, the PFM file could not be read.

Can't write the PCM file

An error occurred while writing to the PCM file, or to the associated
initialization file.

Changing the character range will invalidate the width table

If you enter a width table and then change the first and last characters,
the width table will no longer be valid. This will not occur if you have a
specific font in mind when you create a PFM file.

Couldn't save file filename

The file specified could not be saved because of an error opening or
writing the file, attempting to write over a read-only file, or running out
of disk space.

Default character not in character set

The default character must be between the first and last character in the
character set, inclusive.

Driver information not specified

You attempted to save a file that does not contain PCL driver information.

Error creating the initialization file for filename

The initialization file corresponding to the given file could not be
opened.

Error creating the PCM file filename

The PCM file could not be opened because of an inappropriate filename (such
as a nonexistent directory), a preexisting read-only file of the same name,
or being out of disk space.

filename contains the wrong driver information version

This is a warning indicating that while the PFM file appears to be in the
correct format, the driver-specific information contains a version number
that this PFM Editor does not support.

filename contains the wrong header version number

This is a warning indicating that the PFM header has a version number that
this PFM Editor does not recognize.

filename does not contain driver information

The PFM file does not contain a PCL driver structure.

filename does not contain extended text metrics

This is a warning that the PFM file being read into the PFM Editor does not
contain extended text metrics.

filename has been modified. Save before continuing?

This message allows you to save a file or abort an operation before doing
something that will abandon a modified PFM file, such as choosing the New,
Open, or Exit commands.

filename is not a valid file name

The filename given is invalid because it contains illegal characters or
syntax errors.

filename is not a valid PFM file

The specified file does not contain a PFM file, or the PFM file is either
corrupted or from the wrong version.

Proportional font requires a width table

You attempted to save a PFM file that specifies a proportional font but
does not contain a width table.

Unrecognized device devicename

The PFM contains a device name that the PFM Editor does not recognize. The
only name recognized currently is PCL/HP LaserJet.

Width table will need to be reentered

This is warning indicating that changing your character range invalidates
your width table.

Write over original filename?

A file with the same name as the filename you specified using the Save As
command already exists. Choose Yes to write over the old file, or No to
choose a new name.

Chapter 4  PCL/HP LaserJet Printer Driver

The Microsoft Windows PCL printer driver supports a wide variety of
printers including the Hewlett-Packard printers that use Printer Control
Language (PCL) and fonts. This chapter provides a brief overview of the
features for the driver and in particular those features new for Windows
3.1.


4.1 Features for Windows 3.1

The printer driver for HP LaserJet printers that use PCL includes the
following new features for Windows 3.1:

o   Memory Tracking. This allows users to manage the memory usage on the
    printer. This especially useful when using multiple downloadable fonts.

o   TrueType as Graphics. This allows for drawing glyphs using outlines
    rather then downloaded glyphs.

o   User-Specified Position and Thickness for TrueType Fonts. This allows
    for user control of the appearance of glyphs from TrueType fonts.

o   ResetDC Function. This allows users to change the page orientation or
    paper tray in the middle of a print job.

o   Standard Dialog Boxes. This provides a consistent user interface
    between printer drivers and applications.


4.2 Soft Fonts and Cartridges

Because of the large number of downloadable and cartridge fonts available
for HP LaserJet printers, the driver can only have a few of these fonts
built into it. The driver supports the installation of additional fonts by
supplying a utility called the Printer Font Installer.

The Printer Font Installer adds support for soft fonts and font cartridges
by installing PFM and PCM files and associated screen and soft font files.
The font cartridge manufacturer can use the PFM Editor to create PFM and
PCM files to accompany the font cartridge, or create these files on their
own.


4.3 PFM Files for HP Printers that Use PCL

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.


4.4 PFM Files for Scalable PCL Fonts

Currently, the PCL driver for Windows supports only nonscaling PCL fonts.
The driver will detect scalable fonts by examining the etmMinScale and
etmMaxScale members in the EXTTEXTMETRIC structure. If they are equal, it
will assume a nonscaling font.

A PFM file for scalable PCL font must 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 face 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) */
In the PFMHEADER structure, the dfPixHeight member must contain the height
of a default font size (same as 12 points).

For variable-width fonts, the width-table array contains widths for the
default point size.

In the DRIVERINFO structure, the epEscape member must be nonzero (that is,
a printer escape must be provided).

Optionally, pair-kern and track-kern tables may be provided. The default
font size and width table should be provided for consistency with the
existing driver. If they differ and the dfExtMetricsOffset member is not
NULL, the driver will assume a scalable font.

An extent table must be supplied for scalable fonts. The extent table is an
array of words containing the unscaled widths of the characters. The range
of the table should be from dfFirstChar to dfLastChar. The size of the
table should be dfLastChar - dfFirstChar + 1 word. The driver will scale
the characters using the formulas based on the etmMasterHeight and
etmMasterUnits members.

The driver will not support the ENABLERELATIVEWIDTHS escape, as this would
be difficult to support with scaling and nonscaling fonts intermixed
(scaling fonts use font units; nonscaling fonts use device units).

The driver will assume the dfVertRes member equals 300 dpi. Remember that
etmMasterHeight, etmMinScale, and etmMaxScale must be expressed in device
units.

If the intended printer does not force its widths to 300 dpi units (that
is, etmMasterUnits does not equal etmMasterHeight), the driver will attempt
to correct for roundoff error between the printer's units and the driver's
imposed 300 dpi units. The driver will correct for the error by maintaining
a running roundoff value during output of a single line of text.

You must provide the driver-specific data structure. As described earlier,
the symbolSet member of xtbl member must be equal to epsymRoman8,
epsymUSASCII, epsymECMA94, epsymGENERIC8, or epsymGENERIC7. Use an inverse
translation of the tables provided in the TRANS.H file to build the extent
table if you select epsymRoman8, epsymUSASCII, or epsymECMA94.

You must also provide an escape string pointed to by the epEscape member in
the driver-specific data structure. The driver will send this escape to the
printer to select the font.

If pair or track kerns exist, they should use the same units as the
character widths in the extent table.


4.5 Permanent Soft Fonts

Permanent soft fonts are downloaded to the printer when the printer is
turned on, and remain there until the printer is turned off. Permanent
fonts are downloaded to the printer sometime after power up. The driver
does not have to be active, nor does Windows need to be running for
permanent fonts to be downloaded to the printer. In fact, permanent fonts
are typically downloaded to the printer when the user first turns on the
computer.


4.6 Initialization Settings for PCL Printers

The printer driver for HP printers that use PCL uses a number of sections
and settings in the WIN.INI file. Users set these settings by using the
driver's Printer Setup dialog box or the Printer Font Installer. Normally,
the user should have no need to modify these settings directly.

The most important settings for the driver are the softfonts and softfontn
settings. These set the number of and define the PFM or PCM files for the
soft fonts and cartridges for the printer. The Printer Font Installer sets
these settings when the user installs fonts. However, notice that the
driver has no control over the order of the settings in the WIN.INI file,
and the driver does not currently delete settings from the WIN.INI file.

The order of settings in the WIN.INI file is insignificant and has no
effect on the operation of the driver. If the driver does not delete an
entire entry line from WIN.INI, it removes everything to the right of the
equal sign (=). The title text to the left of the equal sign remains there
until the user manually removes it.

The Windows Printer Font Installer, used in conjunction with the HP
LaserJet driver that uses PCL, also requires these settings that associated
permanently downloaded fonts with their corresponding PFM files. The
following shows the general form for these settings:

    C:\PCLFONTS\HVPB0140.PFM=C:\PCLFONTS\HV140BPN.USP
    C:\PCLFONTS\TRPR0120.PFM=C:\PCLFONTS\TR120BPN.USP
The Printer Font Installer in the driver for HP printers that use PCL uses
these settings to preserve the filenames of the permanently downloaded
fonts. If the fonts are changed to temporary fonts, these settings are
removed and the soft font filenames are added with the appropriate
softfontn setting.

Chapter 5  Printer Font Installer

The Printer Font Installer, an important part of the driver for the
Hewlett-Packard LaserJet printers that use Printer Control Language (PCL),
installs screen fonts, downloadable fonts, PFM files, and PCM files from
floppy disk. Font vendors who distribute fonts on floppy disk can use the
installer to install their fonts. This chapter describes the steps required
to prepare distribution disks for use with the Printer Font Installer.

The Printer Font Installer is in a separate dynamic-link library (DLL)
called FINSTALL.DLL.


5.1 Printer-Font Installation

The HP LaserJet printer driver that uses PCL starts the Printer Font
Installer whenever the user chooses the Fonts button in the driver's Setup
dialog box. If the user then chooses the Add Font button to add fonts, the
installer prompts for a disk containing the fonts to install as well as
additional files.

The installer then searches the specified disk for the printer-font
directory file (FINSTALL.DIR). If the file exists, it reads the file and
installs the fonts specified in it. If there is no printer-font directory
file, the installer performs the following actions:

o   If a file on the disk exists with the .LBL extension, the installer
    assumes the FINSTALL.DIR file is on another disk. It prompts the user
    to switch disks, while allowing the user the option to read the disk
    without the directory file.

o   If there is no .LBL file or the user chooses the first option, the
    installer assumes the directory file does not exist. It then scans the
    disk looking for downloadable font files.

When the installer has to scan the disk for soft fonts, it opens each file
on the disk and looks for the header of a downloadable font file. If it
finds the header, it derives the font name and point size, and displays
this to the user in the list box of soft fonts available for installation.
When the font is installed, the installer will generate a PFM file from the
downloadable font file. Without the FINSTALL.DIR file, it will ignore any
PFM files already on the disk.


5.2 Printer-Font Directory File

The font-installation directory file, FINSTALL.DIR, describes the contents
of the distribution disks for a font package. The Printer Font Installer
uses this information to locate and install the files associated with
screen and downloadable fonts.

The FINSTALL.DIR file typically consists of one or more entries that define
logical disk names, font families, and cartridges. The file can also
contain comments.

The DRIVE statement defines the logical disk names used in other entries in
the file. DRIVE statements must appear before any entries that use the
associated disk names. It is highly recommended that a logical drive be
defined for each floppy disk in the distribution package, and that all
files referenced be preceded by a logical drive ID.

The FAMILY statement defines the screen fonts that correspond to
downloadable fonts, and the CARTRIDGE statement defines the screen fonts
that correspond to a given cartridge. Any number of these statements can be
given in the file, and each statement can specify any number of screen
fonts, downloadable fonts, and cartridges.

The FINSTALL.DIR file should be placed on the first disk in the
distribution set, or on a disk that is clearly marked. If the installer
does not find the file on the first disk it searches, it will assume that
no such file exists use a default procedure for installing fonts.

The following example illustrates the format of a FINSTALL.DIR file:

    /* Acme Corporation's font package.
     *
     * This package consists of two floppy disks: One
     * containing the Acme Ace soft font set and the other
     * containing the Acme Sparrow soft font set.
     */

    /* Logical drives
     */
    DRIVE ACE1: = ACESET1.LBL, "Ace set (disk 1 of 2)"
    DRIVE SPARROW1: = SPRWSET1.LBL, "Sparrow set (disk 2 of 2)"

    /* Ace set */
    FAMILY "Ace" {

        /* Screen fonts */
        1:1 = "Acme Ace 1:1", ACE1:ACE11.FON
        4:3 = "Acme Ace 4:3", ACE1:ACE43.FON

        /* Printer fonts */
        "Ace 36pt"      = P,ACE1:ACE36RPN.USP,ACE1:ACE36RPP.PFM
        "Ace 36pt bold" = P,ACE1:ACE36BPN.USP,ACE1:ACE36RPP.PFM
    }

    /* Sparrow set */
    FAMILY "Sparrow" {

        /* Screen fonts */
        1:1 = "Acme Sparrow 1:1", SPARROW1:SPAROW11.FON
        4:3 = "Acme Sparrow 4:3", SPARROW1:SPAROW43.FON

        /* Printer fonts */
        "Sparrow 36pt"      = P,SPARROW1:SPR36RPN.USP,SPARROW1:SPR36RPP.PFM
        "Sparrow 36pt bold" = P,SPARROW1:SPR36BPN.USP,SPARROW1:SPR36RPP.PFM
    }
For more information about the DRIVE, FAMILY, and CARTRIDGE statements, see
the Section 5.7, Directory File Reference, later in this chapter.


5.3 Setting Up Fonts for Downloading

The Printer Font Installer allows the user to specify whether a font should
be set up for permanent or temporary downloading. The Permanent and
Temporary options in the dialog box specify which action to take.

When a user changes a font from temporary to permanent status, the
installer displays a warning message. This message reminds the user that
permanent fonts take up printer memory, and therefore only the most
frequently used fonts should be permanently downloaded to the printer.

When the user exits the installer, the installer prompts the user for the
download style. If the user selects the Download Now option, the installer
will send a print job consisting of the permanent fonts to the printer. If
the user selects the Download at Startup option, the installer will build a
batch file that downloads the fonts to the printer and edits the
AUTOEXEC.BAT file to call the batch file. The user may select both, one, or
none of these options. As long as the user has permanent soft fonts, the
installer displays this message every time the user exits the installer.

As part of downloading permanent fonts, the installer sends a delete all
fonts escape to the printer. This forces the printer to delete all
permanently downloaded fonts. After downloading the new fonts, a banner
page (in portrait format) is printed that shows the fonts that have been
downloaded. Portrait fonts are shown in the typeface that was downloaded.


5.3.1 Downloading

If you choose Download Now (that is, upon exiting the installer) it is not
a difficult task for the driver. The installer simply opens a Windows print
job and sends down the fonts. Downloading fonts at startup (that is, when
the user turns on the machine) is more complex.

To set up the downloading of permanent fonts at startup, the installer
performs the following tasks:

1.  Writes an executable program that prompts the user to download fonts.

2.  Creates a batch that downloads the fonts and writes out the banner page.

3.  Edits the AUTOEXEC.BAT file to call the download batch file.

The executable program presents the user with a prompt to choose whether or
not to download permanent soft fonts. The program is stored in the driver's
resources and written to its own file when the installer is setting up
fonts for permanent downloading. The downloading batch file calls this
executable program.

The program displays the following prompt:

    Download PCL fonts to port name? [y/n]
If the user responds no, the program returns 1 and the batch file tests the
ERRORLEVEL. The program then exits without downloading fonts.

If the user responds yes, the program returns an ERRORLEVEL of zero, and
the batch file proceeds to download fonts. The batch file is called from
the user's AUTOEXEC.BAT file. The installer edits the AUTOEXEC.BAT file and
appends the following strings to the file:

    command /c C:\PCLFONTS\SFLPT1.BAT
The string that calls the download batch file uses the MS-DOS command /c
option. This enables MS-DOS to suspend execution of the AUTOEXEC.BAT file
to carry out the downloading of file, then return to the execution of the
AUTOEXEC.BAT file. Without command /c, MS-DOS would not return to executing
the AUTOEXEC.BAT file (that is, any commands after the line in the
AUTOEXEC.BAT file would not be executed).

If a user sets up fonts for permanent downloading, but they are not being
downloaded to the printer, the commands in the AUTOEXEC.BAT file are
probably not being executed. The problem may be solved by moving the
commands in the AUTOEXEC.BAT file.

Although the entry the installer creates in the AUTOEXEC.BAT file may be
moved in the file, it should never be modified. This is because the
installer looks for the entry and modifies it if the user changes the fonts
from permanent download to temporary. In this case, the installer inserts a
rem command at the beginning of the entry. This has the effect of disabling
the download entry without deleting it. If the user once again enters the
installer and makes some fonts permanent, the installer will locate the
entry in the AUTOEXEC.BAT file and remove the rem command.


5.4 PFM File Generator

The Printer Font Metrics (PFM) file generator creates PFM files whenever
the installer locates downloadable font files, but fails to locate a
FINSTALL.DIR file. The installer assumes it will have to build PFM files
from the downloadable font files. It reads the header from the font file
plus the widths of each individual character and uses that information to
build the PFM file.

Please notice that when the installer scans a disk for fonts and there is
no FINSTALL.DIR file, it will ignore any PFM files already on the disk and
will attempt to generate PFM files from the font files. It will also
recognize cartridge PCM files.

It is highly recommended that font manufacturers provide their own PFM
files because vendor-supplied PFM files will more accurately represent the
font than PFM files generated by the PFM file generator.


5.4.1 Generated PFM File Names

The PFM file generator builds the following PFM filename.

Value     Meaning
---------------------------------------------------------------------------

1, 2      First two characters from the font filename.

3         P, L, or X for portrait, landscape, or both orientations.

4         B, R, I, or E for bold, roman, italic, or bold/italic (enhanced).

5, 6, 7   Point size in points.

8         Magic number.

The magic number is used by the installer to ensure that the filename is
unique. It starts out at zero. If a file already exists by that name, it is
incremented to 1. The installer continues to increment the number to 9,
then A through Z. If it fails to find a unique filename out of the 36
possibilities, then it will not build the PFM file and reports a Cannot
build PFM file error message.


5.4.2 PFM Data from Font Data

The installer's PFM generator derives the PFM file from the data in the
downloadable font file. The following sections list where the data comes
from for each member in the PFM file structures.


5.4.2.1 PFMHEADER Structure

The installer derives the PFM header from the downloaded file as follows.

Member               Description
---------------------------------------------------------------------------

dfVersion            256.

dfSize               Size of file.

dfType               128.

dfPoints             Height of the font in points (height from header *
                     72/1200).

dfVertRes            300.

dfHorizRes           300.

dfAscent             Baseline position from font header.

dfInternalLeading    (Cell height - height + 2)/4 from font header.

dfExternalLeading    (height/4) - baseline from font header.

dfItalic             Set if the style byte in the header = 1.

dfUnderline          0.

dfStrikeOut          0.

dfWeight             Derived from stroke weight.

dfCharSet            Based upon HP symbol set.

dfPixWidth           If variable width.

dfPixHeight          Cell height from the font header.

dfPitchAndFamily     Pitch bit is set if fixed pitch.

dfAvgWidth           Average of all the character widths (cursor move).

dfMaxWidth           Maximum of all the character widths (cursor move).

dfFirstChar          First character in the font file.

dfLastChar           Last character in the font file.

dfDefaultChar        127 - first character.

dfBreakChar          32 - first character.

dfWidthBytes         0.

dfDevice             Offset from beginning of file to device string PCL/HP
                     LaserJet.

dfFace               Offset from beginning of file to font name.

dfBitsPointer        0.

dfBitsOffset         0.

dfCharOffset         If variable pitch.

dfSizeFields         Size of this part of the PFM structure.

dfExtMetricsOffset   Offset from beginning of file to EXTTEXTMETRIC
                     structure.

dfExtentTable        0.

dfOriginTable        0.

dfPairKernTable      0.

dfTrackKernTable     0.

dfDriverInfo         Offset from beginning of file to DRIVERINFO
                     (driver-specific) structure.

dfReserved           0.

The installer derives the Windows weight value from the weight value in the
font file header as follows.

Hewlett-Packard weight   Windows weight
---------------------------------------------------------------------------

-7                       100 (Thin)

-6                       100 (Thin)

-5                       200 (Extra light)

-4                       200 (Extra light)

-3                       300 (Light)

-2                       300 (Light)

-1                       400 (Normal

0                        400 (Normal)

1                        500 (Medium)

2                        600 (Semi-bold)

3                        700 (Bold)

4                        700 (Bold)

5                        800 (Extra bold)

6                        800 (Extra bold)

7                        900 (Heavy)

The installer determines the Windows character set (dfCharSet) and the type
of translation (in the driver-specific structure, the symbolSet member of
the xtbl member) from the symbol set field in the font file.

---------------------------------------------------------------------------
Hewlett-Packard symbol set   Windows character set   Translation
---------------------------------------------------------------------------

8U (Roman-8)                 0 (ANSI)                Roman-8

0U (USASCII)                 0 (ANSI)                USASCII

11Q                          0N (ECMA-94)            0 (ANSI)

8M (Math-8)                  180 (Math-8)            8-bit pass through

15U (PI Font)                181 (PI Font)           8-bit pass through

0B (LineDraw)                182 (LineDraw)          7-bit pass through

4Q (PC Line)                 183 (PC Line)           7-bit pass through

0B (TaxLnDrw)                184 (Tax Line)          7-bit pass through

1U (US Legal)                185 (US Legal)          7-bit pass through

All others                   0 (ANSI)                7- or 8-bit pass
                                                     through

---------------------------------------------------------------------------

For the generic case, the installer checks the font type byte in the font
header. If it is nonzero, the font uses an 8-bit pass through; if the type
is zero, the font uses a 7-bit pass through.


5.4.2.2 EXTTEXTMETRIC Structure

The installer derives extended text metrics from the download header file
as follows.

Member                          Meaning
---------------------------------------------------------------------------

etmCapHeight                    Baseline from header - dfInternalLeading.

etmDoubleLowerUnderlineOffset   The etmUnderlineOffset member.

etmDoubleLowerUnderlineWidth    The etmDoubleUpperUnderlineWidth member.

etmDoubleUpperUnderlineOffset   etmUnderlineOffset + etmUnderlineWidth * 2.

etmDoubleUpperUnderlineWidth    The etmUnderlineWidth member.

etmKernPairs                    0.

etmKernTracks                   0.

etmLowerCaseAscent              Top offset from character record for 'd';
                                left offset if landscape font.

etmLowerCaseDescent             Character width - left offset from
                                character record for 'p'; height - top if
                                landscape font.

etmMasterHeight                 Cell height from font file header.

etmMasterUnits                  The etmMasterHeight member.

etmMaxScale                     The etmMasterHeight member.

etmMinScale                     The etmMasterHeight member.

etmOrientation                  2 if orientation byte set in header; 1 if
                                not.

etmPointSize                    Cell height *1440 / 300 from font file
                                header.

etmSize                         Size of the EXTTEXTMETRIC structure.

etmSlant                        0.

etmStrikeOutOffset              Left offset - etmStrikeOutWidth from
                                character record for '-'; top offset -
                                etmStrikeOutWidth if landscape font.

etmStrikeOutWidth               Character width from record for '-';
                                character height if landscape font.

etmSubScript                    Cell height from header.

etmSubScriptSize                Cell height from header.

etmSuperScript                  etmCapHeight - etmXHeight.

etmSuperScriptSize              Cell height from header.

etmUnderlineOffset              Top offset from character record for '_';
                                left offset if landscape font.

etmUnderlineWidth               Character width from character record for
                                '_'; character height if landscape font.

etmXHeight                      Top offset from character record for 'x';
                                left offset if landscape font.


5.4.2.3 DRIVERINFO Structure

The generator derives driver-specific information from the download width
tables and symbol set as follows.

Member              Meaning
---------------------------------------------------------------------------

epEscape            0.

epMemUsage          ((sum of all character widths + 7) >> 3) * height + 63.

epSize              Size of the DRIVERINFO structure.

epVersion           1.

firstchar of xtbl   0.

lastchar of xtbl    0.

len of xtbl         0.

offset of xtbl      0.

symbolSet of xtbl   Based upon font symbol set.


5.4.3 Regenerating PFM Files

In some situations, such as when the user reinstalls existing fonts without
the aid of the FINSTALL.DIR file, the installer automatically protects
against generating duplicate PFM files. There are two potential situations:

o   The user reinstalls fonts with PFM files that were initially generated
    by the installer.

o   The user reinstalls fonts that were initially provided by the font
    vendor (that is, either on the distribution disks, or built by a
    utility provided by the font vendor).

To reinstall fonts, the user starts the Printer Font Installer, chooses the
Add Fonts button, and directs the installer to read font information from
the directory containing already installed fonts. Then the user installs
fonts into the same directory. The installer prompts the user if fonts
should be replaced. If the user responds yes, the installer proceeds to
replace every font.

The installer provides a unique name for each PFM file. In this situation,
the installer would give a unique name to a PFM file that was a duplicate
of an existing PFM file. For example, suppose the first time a user
installed a font, the installer generated a PFM filename XYZ0.PFM. When the
user reinstalled the font, the installer would generate a second, identical
PFM file named XYZ1.PFM.

To prevent duplicate PFM files on the disk, the installer contains a
protection mechanism. If the magic number in the PFM filename is not zero,
then the installer compares the contents of the PFM file to the other PFM
files sharing the same name. If it finds a duplicate, it erases the PFM
file it just built and uses the already existing PFM file.

This mechanism prevents the installer from placing duplicate PFM files on
the disk. However, it does not address duplicate names when PFM files were
originally supplied by the font vendor.

NOTE  If the user originally installs fonts provided by a font vendor and
then reinstalls without use of an FINSTALL.DIR file, the installer will
replace the vendor-supplied PFM files with its own generated PFM files. It
does not remove the PFM files from disk; rather it adds its own PFM files
and uses them. Because the installer's PFM generator is not as accurate as
the font vendor's PFM files, the installer may actually end up renaming the
fonts, which causes confusion for the user.

The user should never reinstall soft fonts from and to the same directory
without the aid of an FINSTALL.DIR file. Because the installer contains the
ability to automatically generate an FINSTALL.DIR file of the already
loaded fonts, there really is no reason for reinstalling fonts without the
use of an FINSTALL.DIR file.


5.5 Developing the FINSTALL.DIR File

The Printer Font Installer provides features to help you build, test, and
debug the FINSTALL.DIR file. The following sections describes these
features in detail.


5.5.1 Building an FINSTALL.DIR File

The installer will build an FINSTALL.DIR file for the fonts listed in the
Installed list box of the installer dialog box. The developer should hold
down the CTRL and SHIFT keys while choosing the Exit button. The installer
prompts the user for the name and path of the FINSTALL.DIR file. If a file
by the same name already exists, the installer will prompt to replace the
file.

This feature has several uses:

o   To preserve the soft font and cartridge entries when the user wants to
    reinstall Windows.

o   To expedite moving fonts to another computer.

o   To use as a starter file for developers or power users who want to set
    up a distribution disk of fonts.

This feature is primarily intended to be used by technical support
specialists who are directing users to perform certain operations. A user
may be advised to erase part or all of the contents of his or her machine
and start over. This feature is very useful in preventing the loss of
soft-font information.


5.5.2 Adding Fonts

Developers can gain access to an advanced Add Fonts dialog box by holding
down the CTRL and SHIFT keys when choosing the Add Fonts button. This
dialog box gives developers the following options:

o   The ability to specify the path from which the installer should read
    fonts.

o   The ability to rename the FINSTALL.DIR file.

o   The ability to indicate if an error file should be written and specify
    its name.

The first option is available to users through the normal Add fonts dialog
box. The other two options are intended to be used by font vendors or
advanced users setting up FINSTALL.DIR files for distribution.

Before parsing the FINSTALL.DIR file, the installer will report the screen
aspect ratio. The installer will classify the screen type as either
EGA(4:3) or VGA(1:1). It uses the same algorithm to classify the screen
fonts listed in the FINSTALL.DIR file. The fonts that match the category in
which the screen was classified would be loaded by the installer.

The formula the installer uses to classify screens is as follows:

o   Compute the screen width in lines-per-inch (horizontal resolution
    divided by horizontal size converted from millimeters to inches):

    width = (GetDeviceCaps(HORZ_RES) * 25) / (GetDeviceCaps(HORZSIZE))

o   Compute the screen height in lines-per-inch (vertical resolution
    divided by vertical size converted from millimeters to inches):

    height = (GetDeviceCaps(VERT_RES) * 25) / (GetDeviceCaps(VERTSIZE))

o   Take the inverse ratio of width to height:

    ratio = (height * 10000) / width

o   Categorize the screen type based upon the ratio:

    6250 to 9374     EGA (4:3)

    9375 and above   VGA (1:1)

It is highly recommended that font vendors use the advanced Add Fonts
dialog box to verify that there are no syntax errors in the FINSTALL.DIR
file. If the installer finds errors in the FINSTALL.DIR file, it will write
error messages in the FINSTALL.ERR file. The messages will be of the form:

    line line-number, near character character position : error message
The installer also displays a message indicating that errors were found and
written to the file.


5.6 Printer Font Installer Scenarios

This section presents some sample uses of the Printer Font Installer. It
starts with recommendations for selecting printer and screen fonts, then
presents some cookbook approaches to performing certain tasks with the
Printer Font Installer.


5.6.1 Selecting Printer Fonts

Fonts take up disk space and printer memory. Planning which fonts are
needed and installing only those fonts can save disk space. Selecting fonts
is a subjective process. It requires making tradeoffs between document
design and computer memory, disk space, printer memory, and printing speed.

The recommendations presented in this section are based upon experience
gained from working with Windows and soft fonts. The intent of these
recommendations is to help you optimize the amount of disk space and
printer memory used by soft fonts. Some of the recommendations indicate
that you should not load certain variations of fonts; you may want to
experiment to determine if the additional expense in print time and disk
space is worth including these fonts.

It is recommended that you load the typographic range of point sizes and
limiting documents to using these sizes. The typographic range is as
follows:

    6, 7, 8, 9, 10, 11, 12, 14, 18, 24, 30, 48, 60, 72
Better yet, if you know exactly which sizes you normally use in a document,
load only those sizes. For example, a document may use only the following
point sizes of MS Sans Serif:

    11 point for body text
    9 point for running headers, running footers, and footnotes
    14, 24, and 30 point bold for subheads and headlines
By loading only these sizes, you reduce the number of fonts taking up disk
space.

It is recommended that you generate normal and italic for all point sizes,
and bold for point sizes equal to and above 14 points. The driver for
Hewlett-Packard printers that use PCL has the capability to simulate bold
text. It will not look the same as the true bold face, so you may want to
experiment first (for example, print a document with bold type but with no
bold loaded, and then load the bold and reprint the document). Normally,
however, the driver-simulated bold is adequate for the small point sizes.

To save on even more space, we recommend that you load bold only for the
larger sizes (that is, 24 points and above). The assumption is that you
will only use bold sizes for headlines.

Avoid loading bold italic for a font. Bold italic consumes disk space and
printer memory and, because bold italic is rarely used, it does not warrant
the space it requires. As an alternative, the driver will simulate bold
italic by synthetically bolding the italic face.

Character sets can make a big difference in the amount of disk space and
printer memory used by a font. If the document never uses accented
characters or special symbols like the bullet and copyright, it is
recommended that you use the USASCII character set. If the document
requires these characters, use the Windows ANSI, ECMA-94, or Roman-8
character sets (listed in order of preference, depending upon which sets
you have access to).

Fonts in the USASCII character set contain a little more than half the
number of characters contained in the Windows ANSI, ECMA-94, and Roman-8
character sets. By selecting USASCII, you effectively half the amount of
disk space and printer memory used by the font. We recommend using, in
order of preference, Windows ANSI, ECMA-94, or Roman-8 for point sizes
below 14 points and USASCII for point sizes 14 points and above.


5.6.2 Selecting Screen Fonts

Selecting screen fonts is considerably different from selecting printer
fonts. The selection of screen font sizes should not be based upon the
selected printer font sizes. It does not make sense to build one
corresponding screen font for every printer font for the following reasons:

o   Screen fonts in Windows are sized and modified by the screen driver.
    The screen driver can derive normal, bold, italic, and bold italic
    variations from one screen font.

o   Screen fonts are selected by way of a generic selection process
    controlled by the application and the screen driver. One cannot assume
    that a screen font specifically intended for a printer font will be
    used to display that font.

o   Some applications allow the user to see the font at different views
    (for example, fit in window, 100 percent, and 200 percent). A screen
    font should be provided for each view.

o   Most important, screen fonts take dynamic memory away from
    applications, thus slowing the overall performance of Windows.

Poorly selected screen fonts can both slow the performance of the system
and produce a confusing screen display.

Regardless of the printer font sizes and variations selected, it is
recommended that you load a shortened typographic range of screen fonts:

    8, 9, 10, 12, 14, 18, 24
Load these fonts in normal face only; the screen driver can simulate bold,
italic, and bold italic. There is no need to double, triple, or quadruple
the memory used by screen fonts to get these special fonts.

Do not load screen fonts for printer fonts that are like Courier. Windows
already provides those screen fonts. Additional screen fonts would use up
memory without additional visual benefits.

If you generate one printer font, you should generate the entire
recommended range. Applications typically offer more than one view of the
page, so the screen driver will need the different sizes to display the
font in each view.

If you feel you want the typographic quality of prebuilt bold and italic
screen fonts, then you should experiment to see if these fonts look better
than fonts synthesized by the screen driver. Display a page of text with
only the normal face loaded, then display it with the normal, bold, and
italic faces loaded.

Never load a bold or italic screen font without a corresponding normal face
font. Without the normal face, the screen driver will always use the bold
or italic face, producing a confusing screen display.

For example, suppose you decide to create a document that uses a 24-point
italic font. You then load one printer and one screen font as 24-point
italic. Thereafter, every time the screen driver determines it needs a
24-point screen font that is similar to the font that you installed, it
will use the 24-point italic face. Regardless of the variation you want
(that is, normal, bold, or italic), the font will display in italic.

As you add more fonts to your computer, the situation will become more
confusing. To continue the example, suppose you decide to add the same
printer and screen font as 48-point normal.

When the application displays the 48-point font at 100 percent view on the
screen, the font will display as 48-point normal (that is, the correct
behavior). At 50 percent view, the font will display as 24-point italic
(because that is the only font available). When switching views, therefore,
the font changes from normal to italic.

You can avoid this problem simply by not loading anything other than the
normal face of the screen font. Normally, the difference between the
synthesized font and the true font is barely noticeable, if noticeable at
all. If you must load the italic or bold variations, then you must also
load the normal variation in the same size.


5.6.3 Recovering Soft Fonts from a WIN.INI Change

Sometimes you need to remove the contents of your WINDOWS directory and
reinstall Windows. In the process of doing this, you could lose all the
soft font information. To prevent losing data:

1.  Build an FINSTALL.DIR file.

    Using Windows, select the Printers icon from Control Panel, select the
    HP LaserJet printer that uses PCL, and choose the Setup command.

    Once inside the driver-specific dialog box, choose the Fonts button to
    call the Printer Font Installer. The fonts you plan to save should be
    listed in the left list box. Hold down the CTRL and SHIFT keys while
    choosing the Exit button. The installer prompts for a filename and
    path. Choose the OK button to accept the name of the FINSTALL.DIR file.
    Then, exit Windows.

2.  Reinstall Windows.

    Perform whatever steps are necessary to reinstall Windows (that is,
    remove everything in the WINDOWS directory and run the Windows Setup
    program).

3.  Install from the directory to itself to get the soft fonts listed.

    Run the Printer Font Installer on the new computer through the Control
    Panel's Printers icon. Select the HP LaserJet printer that uses PCL,
    and then choose the Setup command.

    From the driver-specific dialog box, choose the Fonts button to call
    the installer. If the Fonts button is not highlighted, then you need to
    select a printer that supports soft fonts (lower-left list box in the
    driver-specific dialog box). Choose Add fonts and specify \PCLFONTS as
    the source for copying fonts. If your fonts are stored in another
    directory (such as FONTS or PCLPFM), then specify that directory.

    Hold down the CTRL and SHIFT keys while selecting all the fonts in the
    right list box. Choose the Add button between the two list boxes. The
    installer prompts for a target directory. This must be equivalent to
    the directory from which you are installing the fonts. If you are
    installing from \PCLFONTS, then choose the OK button to accept
    \PCLFONTS as the target directory. Otherwise, change the name to that
    of the directory that contains the soft fonts (such as FONTS or PCLPFM).

    The installer then shuffles the fonts very quickly from the right list
    box to the left list box. It does not copy any fonts; it simply updates
    the WIN.INI file. If this does not happen quickly, then you probably
    did not build an FINSTALL.DIR file as described in Step 1, or did not
    install fonts from and to the same directory.


5.6.4 A Quick Method for Moving Fonts to Another Computer

The purpose of this section is to describe how to move fonts from one
computer to another. It is not intended for distributing fonts to several
users. This description is not intended to encourage illegal copying of
fonts. We assume that you are removing fonts from one computer and adding
them to another.

The steps are as follows:

1.  Build an FINSTALL.DIR file.

    Using Windows, select the Printers icon from Control Panel, select the
    PCL/HP LaserJet printer, and choose the Setup command.

    Once inside the driver-specific dialog box, choose the Fonts button to
    call the Printer Font Installer. The fonts you plan to save should be
    listed in the left list box. Hold down the CTRL and SHIFT keys while
    choosing the Exit button. The installer prompts for a filename and
    path. Choose OK to accept the name of the FINSTALL.DIR file. Then, quit
    Windows.

2.  Use the MS-DOS xcopy command to copy files to a floppy disk, by
    following these instructions:

    To change to the directory containing the soft fonts, type:

        cd \PCLFONTS
    To make sure that all the files in the directory are not marked for
    archive, type:

        attrib -a *.*
    To copy files to the first disk, type:

        xcopy *.* a: /m
    If MS-DOS reports an insufficient disk space error, repeat the xcopy
    command. The /m option on the xcopy command instructs MS-DOS to mark
    the files it has copied to disk, so when you repeat the command it does
    not recopy the files that are already on disk.

    Repeat the xcopy command until all the files are on the disks.

3.  Copy the files from the floppy disks to the new machine, by following
    these instructions:

    On the new machine, to make a directory for the fonts, type:

        cd \
        mkdir \PCLFONTS
        cd \PCLFONTS
    To copy the fonts from the floppy disk into the new directory, type:

        copy a:*.*
    Repeat this step for every floppy disk.

4.  Install from the directory to itself to get the soft fonts listed.

    Run the Printer Font Installer on the new machine through Control
    Panel's Printers icon. Select the HP LaserJet printer that uses PCL,
    and then choose the Setup command.

    From the driver-specific dialog box, choose the Fonts button to start
    the installer. Choose Add fonts and specify \PCLFONTS as the source for
    copying fonts. The installer should list all the fonts you just copied
    into the \PCLFONTS directory.

    Hold down the CTRL and SHIFT keys while selecting all the fonts in the
    right list box. Choose the Add button between the two list boxes. The
    installer will prompt for a target directory. This must be the same
    directory from which you are installing the fonts. If you are
    installing from \PCLFONTS, as these instructions indicate, then choose
    OK to accept \PCLFONTS as the target directory.

    The installer then shuffles the fonts very quickly from the right list
    box to the left list box. It does not copy any fonts; it simply updates
    the WIN.INI file. If this does not happen quickly, then you probably
    did not build an FINSTALL.DIR file as described in Step 1, or did not
    install fonts from and to the same directory.

The fonts will be moved to the new computer. This procedure is probably the
fastest and simplest way to move fonts from one computer to the other.
However, we do not recommend it as a general method of distributing fonts.
The installer has a more elegant and less error-prone way of loading fonts
from floppy disks as described in the next section.


5.6.5 Building a Floppy Disk Set of Fonts

This section describes how to set up a floppy disk set of fonts for
distribution. This procedure is useful, for example, if a company chooses
to use a range of fonts available from a font-generation utility. One
person could generate the fonts and create a disk set of fonts for internal
distribution. Then, all the other users could quickly and easily install
the pregenerated fonts without having to learn how to use the
font-generation utility.

To carry out the following procedure, you must know how to use MS-DOS and a
text editor.

The steps are as follows:

1.  Install or generate the soft fonts.

    Load the fonts onto your computer. You should build a set of screen
    fonts for each type of display that may be used. Generally, this would
    be an EGA or a VGA.

    When you make changes to the FINSTALL.DIR file (see Step 4), you can
    instruct the installer to load different screen fonts depending upon
    the aspect ratio of the computer receiving the fonts.

2.  Build an FINSTALL.DIR file.

    Using Windows, select the Printers icon from Control Panel, select the
    HP LaserJet printer that uses PCL, and then choose the Setup command.

    Once inside the driver-specific dialog box, choose the Fonts button to
    start the Printer Font Installer. The fonts you plan to save should be
    listed in the left list box. Hold down the CTRL and SHIFT keys while
    choosing the Exit button. The installer prompts for a filename and
    path. Choose OK to accept the name of the FINSTALL.DIR file. Then, quit
    Windows.

3.  Arrange the font files, PFM files, PCM files, screen-font files, and
    FINSTALL.DIR file onto disks.

    If all the files fit on one disk, this is an easy task. If they do not
    and the number of fonts is great, this may be a major task. For more
    information about arranging the files, see the section at the end of
    this procedure list.

4.  Edit the FINSTALL.DIR file to add logical drives.

    If the files require more than one disk, edit the FINSTALL.DIR file and
    add logical drives so the installer will know where all the files are.
    With logical drives properly set up, the installer will prompt the user
    to switch disks when necessary.

    If you loaded screen fonts, add entries in the FINSTALL.DIR file for
    screen fonts as well. Place the screen fonts in the appropriate FAMILY
    block for which the screen fonts were made.

5.  Test the font-installation process thoroughly.

    Make sure that all the fonts are correctly loaded. If you have screen
    fonts for different aspect ratios, test loading fonts on machines with
    different screen displays.

    Use the advanced Add fonts button to check the syntax of your
    FINSTALL.DIR file, and verify your screen display type.

Arranging font files onto disks can be an extremely tedious task,
especially if you have to set up disks for 360K, 720K (3.5 inch), and 1.2M
builds and need to conserve disk space.

Here are some recommendations:

o   Keep the screen font files for one FAMILY together on the same disk,
    and make sure the lowest point size font is also on that disk.

o   Keep each PFM file on the same disk as its corresponding printer-font
    file.

o   Conserve disk space by putting the largest fonts on the disk with the
    smallest fonts.

o   If you are building the set for different disk densities, build the
    360K set first, then put the files from two disks onto each 720K disk,
    and the files from three disks onto each 1.2M disk.

The easiest way to build the disk set is to place files on the disks in the
exact order in which they appear in the FINSTALL.DIR file. That is, the
FINSTALL.DIR file goes on first, followed by the screen fonts for the first
family listed, followed by the .PFM and font files for that family. Make
sure that all the screen-font files for one family go on the same disk, and
that at least one printer font (the first one listed in the FAMILY
statement) with its PFM file also goes on that disk.

Once the disk set is built and working, reorganize the files to optimize
for disk space usage.


5.6.6 Setting Up Fonts on a Network

This section describes how a network administrator can set up fonts to use
on a network. To carry out this procedure, you must know how to use MS-DOS
and a text editor.

To set up fonts for use on a network, follow these steps:

1.  Install or generate the soft fonts.

    Load the fonts onto your computer. You should build a set of screen
    fonts for each type of display that may be used. Generally, this would
    be an EGA or a VGA.

    When you make changes to the FINSTALL.DIR file (see Step 5), you can
    instruct the installer to load different screen fonts depending upon
    the aspect ratio of the machine receiving the fonts.

2.  Select permanent fonts.

    To use permanently downloaded soft fonts, start the Printer Font
    Installer (described in the next step) and select the fonts you want
    permanently downloaded to the printer. When you exit the installer, it
    will prompt you for the download options. Make sure Download at startup
    is checked.

3.  Build an FINSTALL.DIR file.

    Using Windows, select the Printers icon from Control Panel, select the
    HP LaserJet printer that uses PCL, and choose the Setup command.

    Once inside the driver-specific dialog box, choose the Fonts button to
    start the Printer Font Installer. The fonts you plan to save should be
    listed in the left list box. Hold down the CTRL and SHIFT keys while
    choosing the Exit button. The installer prompts for a filename and
    path. Choose OK to accept the name of the FINSTALL.DIR file. Then, quit
    Windows.

4.  If you are not working from the file server, copy the fonts to the file
    server.

    If you created and installed fonts from the network server, you can
    skip this step.

    Set up a directory on the file server for the fonts and copy all the
    files to it. Use MS-DOS commands to do this. If you set up permanent
    fonts, move the files created by the installer from your computer to
    the network computer, and edit the AUTOEXEC.BAT file on the network to
    transfer the command line starting the download batch file.

5.  Edit the FINSTALL.DIR file to add screen fonts.

    If you generated screen fonts, edit the FINSTALL.DIR file to add
    references to the fonts.

    You do not need to add logical drives to the FINSTALL.DIR file if all
    the font files and PFM files reside in one directory.

6.  Test the font installation process thoroughly.

    Make sure that all the fonts are correctly loaded. If you have screen
    fonts for different aspect ratios, test loading fonts on computers with
    different screen displays.

    Use the advanced Add fonts button to check the syntax of your
    FINSTALL.DIR file, and verify your screen display type.

7.  Announce the availability of soft fonts to network users.

    Instruct your users that the fonts are available. They can load the
    fonts by running the Printer Font Installer and choosing the Add fonts
    button. They should indicate the network drive and path to the
    directory containing the soft fonts. Installing the fonts this way will
    be much faster than loading from floppy disks.

    If you set up permanent soft fonts, then your instructions must list
    those fonts and their ID numbers for the users. Instruct the users to
    choose the Edit button and edit each of the permanent fonts, verifying
    the ID numbers. They must change the ID numbers on any fonts that do
    not match your list.

Make sure that all the users have assigned the correct IDs to their
permanent fonts. This is not as difficult as it seems. There usually are
only a few permanent fonts, and the installer resolves ID conflicts. If the
user attempts to assign an ID to a font that is used by another font, the
installer will ask the user if the other font should be assigned a new ID.
The installer will select the first available ID number when assigning a
new ID.


5.6.7 Setting Up PFM Files for Resident and Cartridge Fonts

It is possible to build special PFM files for printer-resident and
cartridge fonts. These fonts should be set up as permanently downloaded
fonts in the WIN.INI file or collected into a cartridge PCM file. The
special PFM files contain the escape sequences that the driver will send to
the printer to use the fonts. Font or printer vendors will most likely
build the PFM and PCM files.

In short, to set up cartridge and printer-resident fonts, the developer
should do the following:

1.  Build special PFM files.

2.  If appropriate, combine PFMs into a PCM using the PFM Editor.

3.  Make a special FINSTALL.DIR file for loading PFM-only fonts or PCM
    files.

In addition to the structures described for the PFM files, the driver has a
driver-specific data structure that must be added to the file. The
PFMEXTENSION structure contains a dfDriverInfo member. This member is a
file offset to the driver-specific structure. For the PCL driver, the
driver-specific structure is the DRIVERINFO structure.

The value of the members in the DRIVERINFO structure should be filled in as
follows.

Member              Value
---------------------------------------------------------------------------

epEscape            An offset from the top of the file to the escape string
                    that the driver should send to the printer to call the
                    font.

epMemUsage          An approximation of the printer memory used by the font.

epSize              Size of (DRIVERINFO).

epVersion           1.

firstchar of xtbl   (BYTE)0.

lastchar of xtbl    (BYTE)0.

len of xtbl         0.

offset of xtbl      (long)0.

symbolSet of xtbl   epsymGENERIC7 for 7-bit fonts and epsymGENERIC8 for
                    8-bit fonts.

In addition, the escape string for calling the fonts must be written to the
PFM file. The driver will use the escape string pointed to by epEscape to
select the font. Once the PFM and PCM files are built, you must make an
FINSTALL.DIR file.

In PFM files, the absence of the downloadable font file is indicated by two
commas in the font string, as in the following example:

    "Acme Ace 12pt"=PL,  ,  CPY_ACE.PFM
The installer loads these fonts as permanently downloadable soft fonts.
This has one side effect. When the user quits the installer, it will prompt
for download options. Because the installer thinks the fonts are permanent
soft fonts, it will try to download them to the printer. However, it will
not find the permanent font files because they do not exist. Therefore, the
installer will simply ignore the files and not make a download batch file
or open a print job. However, if these fonts are mixed in with other real
permanent soft fonts, then the installer will correctly download those
fonts.

If the intended printer is a standard HP LaserJet, the driver will not load
soft font PFM files. The driver will not load the PFM files when the
intended printer cannot handle soft fonts. However, the user may instruct
the driver to load cartridge font (PCM) information to gain access to the
cartridge font information. To override the soft font restrictions, you can
place the following setting in the driver-specific section of the WIN.INI
file:

    options=7
This setting instructs the driver to load soft font information regardless
of the printer's abilities. However, this is not recommended.


5.7 Directory File Reference

The following is an alphabetical listing of the printer font directory file
statements.

CARTRIDGE

    CARTRIDGE {
        aspect-ratio = "description", screen-font-file
        "cartridge-title" = PCM-file
        .
        .
        .
    }
The CARTRIDGE statement defines the PCM file and screen-font files
associated with a given cartridge. The statement provides one or more sets
of aspect-ratio and cartridge-title parameters defining these associations.


Parameters

   aspect-ratio
   Specifies the width and height of the screen font in lines-per-inch.
   This parameter has the following form:

                         width:height
   More than one aspect ratio may be listed by separating each with a
   comma.

   description
   Specifies a string identifying the screen-font face and other
   information, such as the device for which the font was designed. This
   string should be identical to the text that immediately follows the
   colon (:) in the DESCRIPTION statement of the font resource file.
   Control Panel also uses the DESCRIPTION statement to create an entry for
   the font under the [Fonts] section in the WIN.INI file. The parameter
   must be enclosed in double quotation marks.

   screen-font-file
   Specifies the name and location of the screen-font file. This parameter
   should consist of a logical disk identifier (as given in a preceding
   DRIVE statement) and the filename of the screen-font file. If the file
   is not in the root directory on the given disk, the full path of the
   file should be used.

   cartridge-title
   Specifies the name of the cartridge displayed in the Printer Font
   Installer's list box. This name should, but does not need to, match the
   title in the PCM file.

   PCM-file
   Specifies the name and location of the PCM file for the cartridge. This
   parameter should consist of a logical disk identifier (as given in a
   preceding DRIVE statement) and the filename of the screen font file. If
   the file is not in the root directory on the given disk, the full path
   of the file should be used.



DRIVE

    DRIVE id[:] = label-file [, label-descriptor ]
The DRIVE statement defines the logical name for a given distribution disk.


Parameters

   id
   Specifies the logical name for the given disk. Subsequent statements in
   the FINSTALL.DIR file use the id with filenames instead of physical
   drive identifiers.

   label-file
   Specifies the name of the label file. The Printer Font Installer uses
   this file to determine whether the current disk in the drive is the
   correct disk. The label file must have the .LBL file extension. All
   label files in a set of distribution disks must be unique.

   If Printer Font Installer checks for a label file and does not find it,
   the installer prompts the user to insert the correct disk. The installer
   repeats the prompt until the user inserts the correct disk.

   label-descriptor
   Specifies a general description for the disk. The Printer Font Installer
   uses the description when it prompts for the disk. This parameter (if
   given) must be enclosed in double quotation marks. If the parameter is
   not given, the Printer Font Installer uses the name of the label file as
   the descriptor when prompting for a disk.


Examples

    DRIVE disk1: = disk1.lbl, "Font Library disk #1"
This examples sets disk1 to be the logical name for a disk. The Printer
Font Installer checks for the label file, DISK1.LBL, whenever statements in
the FINSTALL.DIR file use the fontlib1 and a driver identifier.



FAMILY

    FAMILY [ family-name ] {
        aspect-ratio = description, screen-font-file
        font-description = orient, [ download-file ] [, PFM-file ]
        .
        .
        .
    }
The FAMILY statement defines the screen-font files associated with one or
more downloadable files. The statement names a font family and provides one
or more sets of aspect-ratio and font-description parameters defining these
associations.


Parameters

   family-name
   Specifies a general description of the font family. If this parameter is
   given, it must be enclosed in double quotation marks.

   aspect-ratio
   Specifies the width and height of the screen font in lines-per-inch.
   This parameter has the following form:

                         width:height
   More than one aspect ratio may be listed by separating each with a
   comma.

   description
   Specifies a string identifying the font and other information, such as
   the device for which the font was designed. This string should be
   identical to the text that immediately follows the colon (:) in the
   DESCRIPTION statement of the font-resource file. Note that Control Panel
   also uses the DESCRIPTION statement to create an entry for the font
   under the [Fonts] section in the WIN.INI file. The parameter must be
   enclosed in double quotation marks.

   screen-font-file
   Specifies the name and location of the screen-font file. This parameter
   should consist of a logical disk identifier (as given in a preceding
   DRIVE statement) and the filename of the screen-font file. If the file
   is not in the root directory on the given disk, the full path of the
   file should be used.

   font-description
   Specifies the name displayed in the Printer Font Installer's list box.
   This parameter should have the following form:

                         face-name point-size [bold] [italic]
   The face-name should be the exact name for the font. The point-size
   should be the font's point size in decimal, immediately followed by the
   word points or the abbreviation pt. The words bold and italic should be
   used only if the font has those attributes.

   The parameter must be enclosed in double quotation marks.

   orient
   Specifies the font's orientation (portrait or landscape). This parameter
   is either P (or p) for portrait orientation or L (or l) for landscape
   orientation. PL or LP may be used to indicate either orientation.

   download-file
   Specifies the name and location of the downloadable font file. This
   parameter should consist of a logical disk identifier (as given in a
   preceding DRIVE statement) and the filename of the downloadable font
   file. If the file is not in the root directory on the given disk, the
   full path of the file should be used.

   Although the download-file parameter is optional, the commas preceding
   and following it are not. If this parameter is omitted, the PFM-file
   parameter must be present.

   PFM-file
   Specifies the name and location of the printer font metrics file. This
   parameter should consist of a logical disk identifier (as given in a
   preceding DRIVE statement) and the filename of the downloadable font
   file. If the file is not in the root directory on the given disk, the
   full path of the file should be used.

   The PFM-file parameter is optional. Although the Printer Font Installer
   will generate a PFM file if the parameter is omitted, this approach is
   discouraged because PFM files generated this way may be less accurate
   than PFM files created by the font manufacturer.


Comments

If the installer fails to find a font having the same resolution as the
display device but finds fonts with matching aspect ratios, the installer
installs the font whose resolution is less than or equal to the desired
resolution. (If there is no resolution less than or equal to the desired
resolution, then it chooses the lowest resolution.) If there is no screen
font with a matching aspect ratio, the installer installs no screen fonts.


Examples

    FAMILY [ "" ] {
    96:96 = "Courier 8,10,12", disk1:cour03.fon
    "Courier 8pt bold italic"=LP,disk1:cour08bi.usp,disk1:cour08bi.pfm
    }
Chapter 6  PostScript Printer Driver

The Microsoft Windows PostScript printer driver supports a wide variety of
PostScript printers and fonts. This chapter provides a brief overview of
the features for the driver and in particular those features new for
Windows 3.1.


6.1 External Printer Installation

The PostScript driver can support printers that are not listed in its
default list of the supported printers. Such external printers must have
accompanying Windows printer description (WPD) files that provide the
information the PostScript driver needs to access the printer correctly.
Typically, printer vendors create the WPD files for and distribute them
with their printers.

In Windows 3.1, the PostScript driver uses the same process to install both
internal and external printers. If a printer vendor supplies a WPD file and
an OEMSETUP.INF file for the external printer, the user can use the
Printers dialog box in Control Panel to install the printer. In this case,
the OEMSETUP.INF file must have a statement having the same form as the
following example:

    1:PSCRIPT.DRV,1:NEWPRN.WPD,"New PostScript printer","DEVICESPECIFIC"
In this example, 1 represents a logical disk and is previously defined in a
[Disks] section. Control Panel automatically installs both the PostScript
driver (if necessary) and the WPD file to the SYSTEM directory. The first
time the printer is used to print a document, the driver scans all the
installed WPD files, and adds the new external printer to the list of
installed external printers.

In Windows 3.1, the maximum number of external printers a user can install
depends on the available space in WIN.INI. The theoretical limit is 32,000
printers.


6.2 Printer Font Metrics Support

For printers that have hard disks or resident fonts from some other source,
external PFM files can be added to the WIN.INI file to make the driver
aware of these fonts. This is similar to the way soft fonts are installed.


6.3 Printer Selection by Model Name

Windows 3.1 uses model names to identify printers. This means, for example,
that applications create printer device contexts by passing a model name,
such as Apple LaserWriter IINT, instead of the generic driver name,
PostScript.

This use of model name also affects printer selection. When installing a
printer, the driver searches the list of installed internal and external
printers and installed WPD files for the requested model name. This means
the model name stored in the WPD file must exactly match the model name in
the initialization file. If the driver is unable to find the requested
model, it will use the default printer (Apple LaserWriter Plus).


6.4 Device Initialization

The PostScript driver supports the Windows device-initialization functions.
This means that applications can maintain private, device-independent
initialization data that is separate from the default configurations set
using Control Panel. For more information about device-independent
initialization data, see the ExtDeviceMode and DeviceCapabilities functions
in the Microsoft Windows Device Driver Adaptation Guide.


6.5 Initialization File Entries for PostScript Printers

The PostScript printer driver uses global and per-port initialization
sections in the WIN.INI file. These sections specify information about the
PostScript printer.


6.5.1 Global Initialization Section

The global-initialization section, [Pscript], contains data that is not
associated with a particular port. In particular, this section defines the
installed external printers and the corresponding WPD files. The section
has the following form:

    [PSCRIPT]
    External Printers=2
    printer1=abc_ps
    printer2=xyz_ps
The External Printers setting indicates how many external printers there
are. The printern setting indicates the base filename of a given WPD file
associated with the external printer.


6.5.2 Per-Port Initialization Section

The per-port initialization section contains data that is specific to each
port connection. In particular, it defines the printer settings for the
printer connected to the given port. In Windows 3.1, each printer is
identified by model name, so the heading for the per-port initialization
section has the following form:

    [ModelName,port]
The ModelName defines the printer (for example, Apple LaserWriter Plus) and
the port specifies the communication port, such as COM1 or LPT1. The
following is an example of a per-page initialization section:

    [Apple LaserWriter Plus,COM1]
    feed2=1
    feed15=5
Windows saves the state of printer connections on a per-port basis. The
printer number is no longer stored in the section. The number is derived
from the model name.


6.6 Advanced Options Dialog Box

The Windows 3.1 PostScript driver provides an Advanced Options dialog box
that gives the user control of most of the driver's advanced features, such
as duplex printing, font management, TrueType support, and error handling.
The driver displays the dialog box whenever the user chooses the Options
button in the driver's Setup dialog box. Descriptions of the various
advanced options are given in the following sections of this chapter.


6.7 Multiple-Resolution Printer Support

In Windows 3.1, the user can set the resolution of the output by selecting
the Resolution option in the Advanced Options dialog box. Some printers are
capable of printing in multiple resolutions and all printers can emulate
certain resolutions (without changing the physical size of the dots). The
list of hardware-supported resolutions can be viewed by moving the scroll
arrow. Items can be selected from the list or an arbitrary value can be
entered.

The halftone parameters (angle and frequency) do not update automatically
when changing the hardware resolution. You must enter the correct values
manually. Printers that only have one hardware resolution are acceptable.


6.8 Duplex Support

The Windows 3.1 driver supports duplex PostScript printers. If duplex
printing is enabled (by the printer's WPD file), the driver expands the
Options dialog box to give user control of duplex settings.


6.9 PostScript Header Support

The size of the PostScript header is less than 8K. Most header functions
are efficient and compact. This minimizes the overhead of print jobs that
include the header to just a few seconds.

Users who want to reduce printing times as much as possible should download
the header to their printer using the Print Options dialog to make all the
functions used be resident in the printer. With the header in place,
printing times are reduced by about 10 seconds. However, for sending files
to service bureaus, the header must be included in the print job and not
downloaded previously.


6.10 Automatic Error Handler

The Windows 3.1 driver automatically downloads an error handler that exists
for the life of a job. The error handler provides valuable feedback for the
user. If an error occurs, the handler prints a brief message telling the
user what happened and what to do about it, followed by the command and a
trace of the stack at the time of the error. This information can be used
to correct the problem, or give the support staff help in determining the
problem.


6.11 Automatic Handshaking

A common error is mismatched protocol settings between Control Panel and
the PostScript driver. The Windows 3.1 driver will automatically download
code to the printer to select the appropriate handshaking if the printer is
connected to a serial port. If the printer is connected to a parallel port
hardware, standard handshaking is used; network connections do not require
handshaking. Consequently, the Handshake button has been removed.


6.12 EPS Printing

Users can produce an Encapsulated PostScript (EPS) file that can be
imported into applications such as Aldus PageMaker with any Windows
application that prints using the PostScript driver. This is done by
selecting the Print to EPS File option from the PostScript Options dialog
box, and then printing. The output of the print job is redirected into the
PostScript-only EPS file specified in the Options dialog box. No alternate
representation of the image (for example, metafile or TIFF image) is
produced by the driver.

By default, the bounding rectangle is the whole page (that is, the
imageable area of the page). If the printing application issues a
SET_BOUNDS escape, that rectangle will be used instead of the whole page.
Therefore, before printing a page, every application that might possibly
have its output sent to an EPS file should issue a SET_BOUNDS escape with
the bounding rectangle of all the output.


6.13 Detectable Start of Page

In Windows 3.1, the PostScript driver calls the StartPage function at the
beginning of each page. Users can define their own StartPage function to
carry out any per-page processing.


6.14 Document-Structuring Convention Support

The Windows 3.1 PostScript driver can generate output that conforms to the
document-structuring conventions defined by Adobe. These conventions make
it easier for applications to parse and rearrange PostScript output to
perform special operations, or print more efficiently. Users should request
conforming output if they plan on using the PostScript output as input to
another program that processes PostScript files. (This option does not need
to be checked for EPS files.)

The driver creates output that conforms to the Document-Structuring
Convention (DSC) only if the user chooses the Generate Conforming Output
option in the Advanced Setup dialog box. If this option is not explicitly
set, the driver may optimize output for printing efficiency and therefore
cannot guarantee conformance with DSC. In particular, the optimized output
may not be page independent as specified by the conventions. That is, pages
may need to be printed in a specific order, relying on fonts or other
resources loaded from previous pages. For more information about
DSC-conforming output, see version 3.0 of Adobe's Document Structuring
Conventions.


6.15 Color

The PostScript driver is a one bit-per-pixel device. However, this does not
mean it can represent only black and white. Bitmaps in a one bit-per-pixel
format can use any color for the foreground and background.

On black and white devices, colors are converted to gray levels by the
PostScript color machinery. For example, when a bitmap is transferred to
the printer, the foreground and background colors are examined to determine
the two colors to use for the transfer.

Windows uses brushes to fill objects. Patterned brushes are defined by an
8x8 bitmap that is used to tile a region that is to be filled. However,
since the PostScript driver is a one bit-per-pixel device, there is no
color information stored in its brushes. When a brush is used to fill an
object, the current text and background colors are used.

In Windows 3.1, the user can force all colors (other than white) to print
as black by setting the All Colors to Black option in the Advanced Options
dialog box. This option is useful if a printout loses detail from thin,
light-colored areas.


6.16 Color-Separation Support

To provide minimal support for color separation, the Windows 3.1 PostScript
driver recognizes the scignore variable in the PostScript header. Setting
this variable to True disables all color change commands allowing the
application to perform multiple passes over the input, setting the current
color to be the correct process color.

Before starting color separation, an application must set the scignore
variable using the PASSTHROUGH escape and the following string:

    /scignore true def

6.17 Device-Independent Bitmaps

Device-independent bitmaps (DIBs) are used to deal with more than one
bit-per-pixel bitmaps. The implementation in the PostScript driver uses the
PostScript image operator on black and white devices and the colorimage
operator on color devices to render multiple bit-per-pixel images. (Notice,
however, that this makes the output printer dependent.)

Applications that want to print multiple bit-per-pixel images should use
the SetDIBitsToDevice or StretchDIBitsToDevice function to render these
images. GDI will simulate these if the driver does not support them.


6.18 StretchBlt Support

The PostScript driver supports arbitrary scaling of bitmap images. This
means applications can call the StretchBlt function without GDI
intercepting the call and carrying out the scaling on its own. With
StretchBlt implemented in the PostScript driver, the source bitmap is
transferred directly to the printer and stretched using the PostScript
imagemask operator. A run-length encoding (RLE) compression scheme has also
been implemented to reduce the amount of data that needs to be transferred
to the printer.


6.19 Compressed Bitmaps

The user can direct the PostScript driver to compress bitmaps before
sending them to the printer by setting the Compress Bitmap option in the
Advanced Options dialog box. Compressing bitmaps speeds up the generation
of the PostScript output but slows down the printer itself (PostScript
printers need more time to decompress the bitmaps). This option is
recommended only if the user is more concerned about having the printing
application finish quickly than with how long it takes to get the printout.


6.20 Font Management

The Windows 3.1 PostScript driver encloses each page in a gsave/grestore
pair to restore the graphics state (reclaim memory) without deleting
downloaded fonts. Also, the driver now calculates memory consumption during
the course of a print job, and will flush downloaded fonts at the start of
any page if memory is low.

Users can modify this behavior by setting the Printer VM and the Per Page
Font Downloading options in the Advanced Options dialog box. The Printer VM
option specifies how much available memory is in the printer. The driver
uses this setting when calculating memory usage. The Per Page Font
Downloading option directs the driver to flush printer memory at the end of
every page regardless of how much free memory exists. Essentially, this
option forces the driver to downloaded fonts with each page.


6.21 TrueType Support

The Windows 3.1 PostScript driver supports TrueType fonts allowing users to
create and print document containing TrueType fonts on PostScript printers.
The driver also provides a variety of advanced options that let the user
determine how TrueType fonts are to be used with the printer. Depending on
the capabilities of the printer, the user may want to convert TrueType
fonts to an Abode format, or substitute the TrueType font with a
printer-resident font.

The PostScript driver may need to convert the fonts to PostScript
device-font format before downloading to the printer. This is true if the
printer does not support the TrueType font format itself. If the driver
must convert TrueType fonts, it can convert them to either Adobe Type 3
bitmap fonts or Type 1 outline fonts. The user sets the type in the
TrueType option in the Advanced Options dialog box. The TrueType to Type 1
conversion is not exact and may produce fonts of slightly inferior quality
to the original TrueType font. However, using this conversion will reduce
print time and require much less printer memory for documents containing
lots of TrueType fonts at large point sizes.

The user can direct the PostScript driver to substitute PostScript
printer-resident fonts for TrueType fonts by using the Substitution option
in the Advanced Options dialog box. This option displays another dialog box
that lists the TrueType fonts and lets the user choose the substitution
font. Using substitution fonts reduces print time and requires less printer
memory.

If the printer supports the TrueType font format, the user can also direct
the driver to download TrueType fonts to the printer by using the
Substitution option in the Advanced Options dialog box. In this case, the
user sets the Download as a SoftFont option for a TrueType font instead of
choosing a printer-resident font. The driver converts the TrueType font to
a soft font and downloads it to the printer. This is the default for any
TrueType font that hasn't been assigned a printer font in the substitution
table.


6.22 Rotated Text

The PostScript driver can support printing text at any angle. Applications
may create fonts using any Escapement value (that is, by specifying the
angle of the baseline). The only limitation is that the Orientation (that
is, the angle of individual characters) is ignored.


6.23 Escapes

There are four PostScript-related printer escapes: EPSPRINTING,
POSTSCRIPT_DATA, POSTSCRIPT_IGNORE, and GETSETSCREENPARAMS.

The EPSPRINTING escape is intended for applications that produce their own
PostScript. It suppresses the Windows PostScript header. With this option
on, no GDI output functions will work.

The POSTSCRIPT_DATA escape is just like the PASSTHROUGH (also known as
DEVICE_DATA) escape except that it is recognized only by PostScript
devices. This escape is intended for applications that produce two
representations of the output: one intended for PostScript devices and the
other for non-PostScript devices. It should be used in conjunction with
POSTSCRIPT_IGNORE to make the PostScript driver ignore the GDI
representation.

The POSTSCRIPT_IGNORE escape is used to make the PostScript driver ignore
or accept all the output. The lpInData parameter points to a Boolean value
that indicates whether the GDI functions should be ignored (TRUE) or not
(FALSE, the default).

The GETSETSCREENPARAMS escape, new for Windows 3.1, sets and retrieves the
current screen parameters, such as angle and frequency, for halftoning. The
user can also set these parameters by using the Halftone Frequency and
Halftone Angle options in the Advanced Options dialog box.

Detailed descriptions of other escapes are available in the Microsoft
Windows Device Driver Adaptation Guide which has driver-oriented
descriptions.


6.24 PostScript Printer Communications

Most PostScript printers support both serial and parallel ports. The
fastest and most efficient way to connect your printer to your computer is
usually with a parallel port (LPTx). If your printer has both a parallel
and a serial port, the parallel port should be used.

If you are using serial communications and have a newer PostScript printer,
you may be able to increase the transmission rate from the standard 9600
baud. Many printers support communications of 19,200 baud.

The following is a PostScript program that can be sent to the printer to
set it up for 19,200-baud communications. Save the following in a file
called 19200.PS and then use the MS-DOS copy command (COPY 19200.PS COM1:)
to send it to the printer.

    % set laserwriter for 19200 baud
    %   set up hardware handshaking
    %   see page 121-122 of apple manual for details
    %   use ETX/ACK (cts/rts)
    serverdict begin 0 exitserver
    statusdict begin 25 19200 7 setsccbatch end
    % a ^D should be appended to this file in most cases
NOTE This will set the speed permanently (even after a power cycle). Use
the following PostScript program to reset the communications channel to the
default 9600 baud.

    % set laserwriter for 9600 baud
    %   set up hardware handshaking
    %   see page 121-122 of apple manual for details
    %   use ETX/ACK (cts/rts)
    serverdict begin 0 exitserver
    statusdict begin 25 9600 0 setsccbatch end
    % a ^D should be appended to this file in most cases
You will also have to set the port on the computer to this speed by issuing
the following command, which should go in your AUTOEXEC.BAT file:

    MODE COM1:,19200,n,8,1

6.25 Driver Limitations

The following are limitations placed on the driver by PostScript:

o   PostScript does not support most raster operations (Rops). However, it
    does support BLACKNESS, WHITENESS, and SRCCOPY.

o   PostScript has a 750-point polygon limit. This number is reduced by two
    when filling with a hatch or pattern. This is because a clipping path
    must be built as well as the path to fill and stroke. In cases where
    this limit is reached, the driver will request that GDI simulate the
    polygon. This is very slow. Applications should avoid generating large
    polygons.

Chapter 7  External PostScript Printers

In addition to supporting a wide variety of PostScript printers, the
Microsoft Windows PostScript printer driver can also support any new
PostScript printers for which the user installs an external printer
definition.

For the user to be able to do this, the printer manufacturer must supply a
Windows Printer Description (WPD) file that contains information about the
new printer. Printer manufacturers create the WPD files by compiling
Adobe-standard PostScript Printer Description (PPD) files with the MKPRN
utility. This chapter describes how font manufacturers can build the WPD
files and distribution disks that will enable users to add a printer to the
Microsoft Windows PostScript printer driver.


7.1 Building and Distributing WPD Files

To build Windows Printer Description files, a font manufacturer must first
build PPD files for each printer and PFM files for the each printer's
resident font or soft fonts. The font manufacturer then uses the MKPRN
utility to generate the WPD file.

To distribute WPD files, a font manufacturer copies the WPD file to disk
along with a OEMSETUP.INF file that describes the external printers the WPD
file supports.

Once a WPD file is installed, it defines the following features of the
external printer:

o   Resident fonts

o   Paper sizes and input trays

o   Commands that activate sizes and trays

o   Imageable area of each supported page size (that is, the area on which
    the printer can actually mark)

The following sections describe the formats of the various files.


7.2 PostScript Printer Description Files

The PostScript Printer Description file format, defined by Adobe and
extended by the Microsoft, provides the basis for external printer
descriptions. This ASCII file contains one or more statements, each
consisting of a keyword and associated values.

Each keyword defines a feature of the PostScript printer. The associated
values specify whether the feature is available, or how the feature affects
the operation of the printer. For example, the *FileSystem keyword
specifies whether a printer supports fonts loaded on a hard drive. PPD
files must be standard ASCII files with carriage return and line feed pairs
terminating each line.

To ensure the best performance for a printer, the PPD file should be as
complete as possible. Windows 3.1 has defined new PPD keywords that should
be added to existing PPD files to create new WPD files. If these keywords
are not added, the driver can still use the old WPD files, but it will
assign default values to any keywords not explicitly defined.

The following provides descriptions of the PPD keywords.

Keyword                Description
---------------------------------------------------------------------------

*ColorDevice           Indicates whether the printer supports color.

*DefaultFont           The name of the default font (that is, the font used
                       if none is selected). This setting must appear
                       before any *Font settings.

*DefaultInputSlot      The default input slot.

*DefaultResolution     The default resolution of the printer.

*Duplex                PostScript commands to set duplex mode. This feature
                       is new for Windows 3.1.

*FileSystem            Reserved; do not use.

*Font                  The fonts resident in the printer.

*FreeVM                Amount of free memory in standard printer
                       configuration. This feature is new for Windows 3.1.

*ImageableArea         The actual area that can be marked on for every
                       paper size.

*InputSlot             The PostScript code that is necessary to specify
                       each input slot.

*ManualFeed False      The PostScript code that is necessary to turn off
                       manual feed. If present, it is assumed that manual
                       feed is supported.

*ManualFeed True       The PostScript code that is necessary to specify the
                       manual feed operation. If present, it is assumed
                       that manual feed is supported (and therefore
                       PageRegion settings must be included).

*NickName              The name that appears in the printer dialog box. It
                       should be a unique description of the printer. This
                       is also the name used for automatic printer
                       recognition.

*PageRegion            The PostScript code that is necessary to specify
                       different page sizes when using manual feed.

*PageSize              The PostScript code used to specify the different
                       page sizes that are supported (when not in
                       manual-feed mode).

*PaperDimension        The size of all the used paper types. A Paper
                       Dimension setting must be included for every size of
                       paper supported. The sizes of the standard page
                       types should be used. Only standard page types are
                       recognized.

*SetResolution         Used to determine the hardware resolution(s)
                       supported. This feature is new for Windows 3.1.

*Transfer Normalized   The normalized transfer function used to generate
                       linear gray levels. This must be present. If none is
                       required, include the nul function { }.

The following is a list of PPD extensions.

Extension           Description
---------------------------------------------------------------------------

*AcceptsTrueType:   True or false. If true, TrueType fonts will be
                    downloaded natively using readhexsfnt operator. This is
                    selected through the download option in the Advanced
                    Options dialog box. If false, TrueType will not be
                    displayed as a selection. This feature is new for
                    Windows 3.1.

*EndOfFile          Indicates whether ^D is required to indicate the end of
                    the file. This is true by default, and only needs to be
                    included if this is false (that is, *EndOfFile False).

*SetPage            True or false. If true, the PostScript driver allows a
                    custom paper size to be defined. This is implemented
                    through the use of the setpage operator. If your
                    printer supports the setpage operator in the same
                    manner as Linotronic(R) printers, you can use this
                    option.

*TrueImageDevice:   True or false. If true, the PostScript driver takes
                    advantage of some optimizations available in TrueImage.
                    Currently there is very little difference in the
                    output. This feature is new for Windows 3.1.

The following are the paper keywords used to show the paper sizes
supported.

Keyword        Description
---------------------------------------------------------------------------

10x14          10 x 14 inches physical size, oriented in portrait mode.

11x17          11 x 17 inches physical size, oriented in portrait mode. Can
               be used interchangeably with the keyword Tabloid.

A3             297 x 420 millimeters physical size, oriented in portrait
               mode. Refers to the International Standards Organization
               (ISO)/(JIS) A3 paper size.

A4             210 x 297 millimeters physical size, oriented in portrait
               mode.

A4Extra        9.27 x 12.69 inches physical size.

A4Small        210 x 297 millimeters physical size, but with a reduced-size
               imageable area of 7.47 x 10.85 inches that is centered on an
               A4 page. Supports the Adobe PostScript paper definitions.

A5             148 x 210 millimeters physical size, oriented in portrait
               mode.

B4             250 x 354 millimeters physical size, oriented in portrait
               mode. Refers to the Japanese Industrial Standard (JIS) B4
               paper size.

B5             182 x 257 millimeters physical size, oriented in portrait
               mode.

Folio          8.5 x 13 inches physical size, but with a reduced-size
               imageable region, oriented in portrait mode and centered on
               the folio sheet. Supports the Adobe PostScript paper
               definitions.

Ledger         17 x 11 inches physical size, oriented in landscape mode
               (that is, the y-axis is on the shorter edge of the paper).

Legal          8.5 x 14 inches physical size, oriented in portrait mode.

LegalExtra     9.5 x 15 inches physical size.

Letter         8.5 x 11 inches physical size. Refers to the standard paper
               type.

LetterExtra    9.5 x 12 inches physical size.

LetterSmall    8.5 x 11 inches physical size, but with a reduced-size
               imageable region that is centered on the page. Supports the
               Adobe PostScript paper definitions.

Note           8.5 x 11 inches physical size, but with a reduced-size
               imageable region. This is used to reduce the size of the
               page buffer to give print jobs more memory.

Quarto         215 x 275 millimeters physical size, but with a reduced-size
               imageable region, oriented in portrait mode and centered on
               the quarto sheet.

Statement      5.5 x 8.5 inches physical size, oriented in portrait mode.

Tabloid        11 x 17 inches physical size, oriented in portrait or
               tabloid mode (that is, the y-axis is on the longer edge of
               the paper).

TabloidExtra   11.69 x 18 inches physical size.

For paper extensions, five standard envelope sizes are recognized. The two
groups of numbers following the word Envelope indicate the size of the
envelope in points (where each point equals 1/72 of an inch).

Extension          Description
---------------------------------------------------------------------------

Envelope.279.639   #9 Envelope (3.875 x 8.875 inches)

Envelope.297.684   #10 Envelope (4.125 x 9.5 inches)

Envelope.324.747   #11 Envelope (4.5 x 10.375 inches)

Envelope.342.792   #12 Envelope (4.75 x 11 inches)

Envelope.360.828   #14 Envelope (5 x 11.5 inches)

The following are the paper tray and bin keywords used to show and specify
the input slots supported.

Keyword         Description
---------------------------------------------------------------------------

LargeCapacity   This one can hold more than a standard amount of paper.

Lower           If there is more than one tray, this one is on the bottom.

Middle          This one is in the middle.

OnlyOne         There is only one tray.

Upper           If there is more than one tray, this one is on top.

The following list describes the paper tray extensions.

Extension        Description
---------------------------------------------------------------------------

AutoSelect       Printer can select automatically which feeder to use. This
                 is followed by the code (or a nul command if no code is
                 required) that is used to specify the autofeed mechanism.

Envelope         There is an envelope feeder.

EnvelopeManual   There is a manual envelope feeder.

None             There are no input feeders. This is treated as being the
                 same as OnlyOne.

The following keywords are required to support duplex printing.

Keyword                   Definition
---------------------------------------------------------------------------

*Duplex DuplexNoTumble:   statusdict begin false settumble true
                          setduplexmode end

*Duplex DuplexTumble:     statusdict begin true settumble true
                          setduplexmode end

*Duplex None:             statusdict begin false setduplexmode end

*DefaultDuplex            None

If the PPD with correct *Duplex settings is built with the Windows 3.1
MKPRN utility, the driver expands the Options dialog box to give user
control of duplex settings.


7.3 PFM Files for PostScript Printers

Because PostScript fonts are scalable, the PFM files for the PostScript
fonts do not contain width tables. The files have the following form:

    PFMHEADER       Header;          /* font header */
    PFMEXTENSION    Extensions;      /* extensions */
    char            DeviceName[];    /* printer device name */
    char            FaceName[];      /* font face name */
    EXTTEXTMETRIC   ExtTextMetrics;  /* extended text metrics */
    WORD            ExtentTable[];   /* unscaled character widths */
    DRIVERINFO      DriverInfo;      /* driver-specific information */
    PAIRKERN        KerningPairs[];  /* pair-kerning table (optional)*/
    KERNTRACK       KerningTracks[]; /* track-kerning table (optional)*/
The PostScript driver for Windows assumes all PostScript fonts are scalable
fonts, so it ignores the dfPoints and dfPixHeight members in the PFM
header. The members dfAvgWidth and dfMaxWidth are in units of 1000
units-per-em.

Although the PostScript naming convention includes the attributes of the
font (that is, bold and italic) in the font name, the attributes should be
stripped from the font name and represented in the dfWeight and dfItalic
members in the PFM header.

The extent table is an array of 16-bit values containing the unscaled
widths of the characters and assuming 1000 units-per-em. The range of the
table should be from dfFirstChar to dfLastChar. The size of the table
should be dfLastChar - dfFirstChar + 1.

Pair-kern values should be in the same 1000 units-per-em measurement as the
extents. As of this writing, we do not know of any application that uses
the track-kern table.

In the EXTTEXTMETRIC structure, the PostScript driver assumes the following
values for each font:

dfVertRes = 300

etmMasterHeight = 300

etmMasterUnits = 1000

In other words, the driver assumes all fonts use Adobe's standard 1000
units-per-em method for describing a font. You must build the extent table
based upon 1000 units-per-em to be consistent with this restriction in the
driver.

The driver also assumes that the font may be scaled to any point size the
application requests. We recommend that the true scaling range of the font
be indicated in the etmMinScale and etmMaxScale members (in device units,
at 300 dpi). The driver currently ignores these members.

Because the Windows PostScript driver assumes all PostScript fonts are
scalable fonts, it ignores the etmPointSize member. The etmSize member is
not the point size, but rather the size (that is, the number of bytes) of
the EXTTEXTMETRIC structure.

As of this writing, we do not know of any application that uses the members
in the EXTTEXTMETRIC structure except for etmKernPairs. 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 does use
them.

The driver-specific data structure pointed to by dfDriverInfo is a
null-terminated string containing the PostScript name for the font. There
are two names for the font:

o   The Windows name for the font which appears in the font list in the
    application's font dialog box.

o   The PostScript name for the font, which can vary according to printer
    manufacturer and which the driver sends to the printer to select the
    font.

Both strings must be null-terminated. The Windows name for the font is
pointed to by dfFace and the PostScript name for the font is pointed to by
dfDriverInfo.

To create a PFM file for the internally-supported printers, Microsoft
converts Font Metric (AFM) files to the PFM file format. These files,
provided with the DDK, are ASCII files that define the metrics for each
font. There are 63 AFM files supporting 63 unique fonts. Printers with
resident fonts that are not supported in the current version of the driver
will need to define those files as soft fonts.

If you need to define a font that is not available currently in the
PostScript printer driver, you will need to modify the driver sources to
add additional AFM files. Please refer to the PostScript driver's MAKE file
that is included on the DDK disks for more information on how the driver
builds AFM and PFM files.


7.4 Printers Setup File

The printers setup file (OEMSETUP.INF) should reside on the disk
distributed with the WPD file. This file follows the standard format used
in the Windows CONTROL.INF file. It contains a [io.device] section that
lists the PostScript printer names for each set of WPD files included on
the disk. The file has the same form as the following example:

    [io.device]
    7:pscript.DRV,7:L630_52&.WPD,"Linotronic 630","DEVICESPECIFIC"
If the user tries to install a printer that is already installed, the
printer driver will ask whether the previous WPD file should be updated.

Manufacturers that are already supported internally in the driver should
not provide WPD files with names that conflict with those used internally.
If an update is required, add the PostScript version number to the printer
name (in both the OEMSETUP.INF file and the *NickName section of the PPD
file).


7.5 Compiling with the MKPRN Utility

The MKPRN utility, an MS-DOS utility, takes a PPD file and all the PFM
files referenced in the PPD file, and produces the WPD file needed for a
printer to be supported by the Windows PostScript printer driver. The
utility has the following command syntax:

    mkprn [/v] [/s] ppd-file
Parameter   Description
---------------------------------------------------------------------------

/v          An optional verbose switch. This causes MKPRN to print messages
            as it processes various elements in the PPD file. This may be
            useful for debugging PPD files.

/s          Suppresses combining the PSS, CAP, and DIR files into one WPD
            file. This is used only when building the driver sources, and
            is not intended for use by external printers.

ppd-file    This is the base filename (with no extension) of the PPD file
            to be processed. The WPD file shares this base filename.

Error messages are printed for fonts that are not found and for identifiers
that are not recognized. If fonts are not found, they are not built into
the WPD file and have to be added as soft fonts as described in the next
section.


7.6 Soft Fonts

A soft font installer is not available yet for the PostScript printer
driver. Therefore, it is up to the printer manufacturer to install
additional fonts as soft fonts by adding the appropriate WIN.INI entries.

The softfontn settings in WIN.INI can be used for several different
purposes. Basically, they inform the driver that a given printer has extra
fonts available and, if necessary, indicate a file that needs to be
downloaded to make that font available. If there is a second file listed in
a softfontn setting, it is assumed that it needs to be downloaded to
activate the given font. Thus, soft fonts can be used to support resident
printer fonts that have been downloaded previously, that reside on a
printer's hard drive, or that are available in some other form.

The softfonts setting indicates how many soft fonts are installed and
listed. The maximum number of soft fonts allowed is based on available
memory and other considerations. The maximum number of soft fonts is at
least 450.

Each softfontn setting references the PFM file associated with a soft font
and, optionally, the soft font that will be downloaded to the printer at
print time. Each filename may be a complete pathname. The two forms of soft
fonts supported are described in the following subsections.


7.6.1 Adobe Soft-Font Format

Adobe soft fonts (files with an .AGB extension) are recognized by the
following string:

    %!PS-AdobeFont
The string must be located at offset 6 in the file. The first 6 bytes are
defined by the following data structure:

    typedef struct{
            unsigned char flag;
            char type;      /* 1 means data is ASCII, 2 means binary */
                            /*    (convert to ascii) */
            long length;    /* length of the data that follows */
            } HDR;
The members indicate the length of the soft font as well as the type (ASCII
or binary). Binary forms are converted to hexadecimal ASCII by the driver;
ASCII fonts are copied directly.


7.6.2 Non-Adobe Soft-Font Format

Fonts that do not have the above-mentioned signature are copied to the
output stream. Therefore, the whole file must be in PostScript code that
describes the font.


7.7 Testing the WPD Files

PostScript printer manufacturers should test their WPD files before
distribution. Do the following:

1.  Copy the OEMSETUP.INF and WPD files to a disk.

2.  Install the printer by choosing the Add button in the Printers dialog
    box in Control Panel. Select the appropriate printer and choose the
    Install button.

3.  Select the newly installed printer from the Installed Printers list
    box, and set it to be the default printer.

4.  Test the following features of your printer:

    o   *NickName. Make sure that the model name in the Setup dialog box is
        the same as the name in the OEMSETUP.INF file, and the *NickName
        field of the PPD.

    o   Paper Sizes. Make sure that all the paper sizes are available and
        that the imageable areas are correct.

    o   Paper Sources. Test that all the paper sources can be selected
        properly.

    o   Normalized Transfer Function. Use an application (for example,
        Micrografx Designer 2.0) that can generate gradiated fills to make
        sure that gray levels are represented in a linear fashion.

If you find any problems, make the appropriate changes to the PPD file,
rebuild the WPD file, and install the new WPD over the existing one.

NOTE  The description string in OEMSETUP.INF needs to match the *NickName
keyword from the PPD file.

