## Printer Device Driver

[prev][next][parent][TOC]

### prda_RealizeFont

Attempts to match a device font to a requested logical font and returns a LONG handle to the font if successful.

pfatLogFont Pointer to a FATTRS structure containing logical font information if this is a RF_DEVICE_FONT command.

lFontHandle Handle of the logical font to be deleted, if this is an RF_ DELETE_FONT command.

RF_DEVICE_FONT Attempt to match font, return handle.

The PostScript driver will always return a matching device font unless a code page is requested that we cannot support. If a legitimate code page is requested but no match is provided and the facename cannot be matched, the default font will be used. The algorithm used is:

Check the lMatch field of the FATTRS structure. If it is positive, it is downloaded as a PFB. If it is negative, the font is treated as a device font; otherwise, if a font name is provided, the driver attempts to match it to one of the font names in the list of fonts supported by the current printer. If a match is found, the matched font is selected. If a match is not found or if the font name is null, the default font is chosen.

As soon as a font has been chosen, the driver must handle code pages. If the usCodePage field of the FATTRS structure is zero, the driver simply chooses the code page provided by the font. Otherwise, it tries to get a mapping vector from the requested code page to the code page supported by the font. If the driver cannot get such a vector, the font is not realizable, and the driver returns zero to the engine.

As soon as a font has been chosen and a suitable code page mapping vector has been found, the driver looks for space in the logical font information table in the PDDC. If an entry is free, the driver allocates it, initializes its records, and returns the negative of the index as the 32- bit handle. If the table is full, an error must be returned.
RF_LOAD_ENGINE_FONT Return 0L, font can't be realized.

The driver always returns 0L.
RF_DELETE_FONT Attempt to delete font with handle specified.

If the handle provided is legitimate, the driver erases the corresponding font from the logical font information table and returns 1L. Otherwise, it must return an error. If the provided handle corresponds to the logical font currently in use, the driver selects the default font before deleting the logical font.