Previous Next

Customized Font Management

For printer control language (PCL) printers, Unidrv supports downloading soft fonts as bitmaps or TrueType outlines. For device fonts, Unidrv supports PCL, CAPSL, and PPDS printer command formats. For other formats, customized font management code must be provided in a rendering plug-in. The following set of IPrintOemUni methods can be implemented:

IPrintOemUni::DownloadFontHeader
Used for obtaining a soft font's header information from Unidrv and then downloading the information to the printer.
IPrintOemUni::DownloadCharGlyph
Used for downloading a soft font's character glyphs to the printer.
IPrintOemUni::OutputCharStr
Used for controlling the printing of characters.
IPrintOemUni::SendFontCmd
Used for modifying a printer's device font selection command, if necessary, and then sending it to the printer.
IPrintOemUni::TextOutAsBitmap
Used for creating a bitmap image of a text string.
IPrintOemUni::TTDownloadMethod
Used for specifying the glyph format that Unidrv should use when sending a specified soft font to the printer.

Unidrv provides a callback function, UNIFONTOBJ_GetInfo, that rendering plug-ins can call to obtain font or glyph information.

For device fonts, font descriptions must be provided in the form of Unidrv Font Metrics files and Glyph Translation Table files.

For cartridge fonts, font descriptions can be provided in resource DLLs and specified using font cartridge entries in a generic printer description (GPD) file. Font descriptions can also be provided in the form of Unidrv Font Format files.

For downloadable PCL soft fonts, font descriptions must be provided in the form of Unidrv Font Format files.

Unidrv Font Metrics Files

Each device font that a printer supports must be represented by a Unidrv Font Metrics (.ufm) file. A .ufm file is a binary file that is constructed using the structures described in Unidrv Font Metrics Structures. The first structure in a .ufm file is UNIFM_HDR, which contains offsets to the file's other structures. The following figure shows the layout of a Unidrv Font Metrics file.

Layout of a Unidrv Font Metrics File

For more information about creating .ufm files, see the Microsoft Minidriver Development Tool.

Unidrv also supports .ifi files, the font metrics files created for Windows NTŪ 4.0.

Glyph Translation Table Files

Each device font that a printer supports must be represented by a Glyph Translation Table (.gtt) file. A .gtt file is a binary file that is constructed using the structures described in Unidrv Glyph Translation Table Structures. The first structure in a .gtt file is UNI_GLYPHSETDATA, which contains offsets to the file's other structures.

Layout of a Glyph Translation Table File

In the preceding figure, the UNI_GLYPHSETDATA structure contains the offsets from the beginning of the file to the first GLYPHRUN structure, to the first UNI_CODEPAGEINFO structure, and to the MAPTABLE structure. For more information about creating .gtt files, see the Microsoft Minidriver Development Tool.

Unidrv also supports glyph translation files created for Windows NT 4.0, which use RLE compression and have an .rle extension.

Unidrv Font Format Files

For cartridge fonts that are not specified using font cartridge entries in a GPD file, the fonts must be described in a Unidrv Font Format (.uff) file. Additionally, downloadable PCL soft fonts must be specified using .uff files.

A .uff file is a binary file that is constructed using the following sets of structures:

Layout of a Unidrv Font Format File

A Unidrv Font Format file consists of a UFF_FILEHEADER structure, and one or more UFF_FONTDIRECTORY and DATA_HEADER structure pairs. Each DATA_HEADER structure is associated with a block of font data. The UFF_FILEHEADER structure contains the offset from the beginning of the file to the first UFF_FONTDIRECTORY structure. Each UFF_FONTDRECTORY structure contains the offset from the beginning of the file to a DATA_HEADER structure that contains font data.

Additionally, for downloadable PCL soft fonts, the binary data to be downloaded is stored in a .uff file.

Creating .uff files is the responsibility of vendor-supplied font installation software. Unidrv reads a printer's .uff files to obtain font and glyph information. The font installer should modify .uff file contents when fonts are added or deleted. For more information about creating a font installer, see Customized Font Installers for Unidrv.

All .uff files must be stored in the %SystemRoot%\System32\Spool\Drivers\Unifont directory. To associate individual .uff files with specific printers, installation software must call the SetPrinterData function (described in the Platform SDK documentation) to create registry values under each printer's registry key. The following table lists the registry value names that must be used, and indicates the maintainer of each value.

Registry Value Name and Type Value Definition Maintainer
"ExternalFontFile"

REG_SZ

Filename of a .uff file specifying currently installed fonts. Fonts can be downloadable or contained in a cartridge. Font Installer
"ExtFontCartFile"

REG_SZ

Filename of a .uff file specifying all the fonts contained in all the font cartridges listed for "ExtFontCartNames". Font Installer
"ExtFontCartNames"

REG_MULTI_SZ

Names of all the font cartridges that could possibly be installed on the printer. Font Installer
"FontCart"

REG_MULTI_SZ

Names of all the font cartridges currently installed for the printer. Unidrv user interface

After adding a font cartridge to a printer, the system administrator must run the font installer, which is responsible for copying font descriptions from the .uff file specified by "ExtFontCartFile" into the .uff file specified by "ExternalFontFile". Likewise, the font installer must remove font descriptions from the .uff file specified by "ExtFontCartFile" when a cartridge is removed.