NT RLE Character Mapping

To fully support Unicode, Windows NT has changed the format of the Windows 3.1 CTT to the new RLE format. RasDD can still use the old format (for compatibility with 16-bit minidrivers), but the RLE format supports the wide characters of Unicode and speeds up CreateDC calls by having much of the font information precomputed in the format required by GDISrv.

The CTT file contents can be saved into one of three formats. Unitool determines which one is to be used to save the CTT file based on the information that was entered as follows:

The differences between these formats is transparent to the user. Unitool creates the CTT in a format that results in the smallest file size depending on the actual translation. Printer commands sent from the CTT do not change the permanent state of the printer.

The Window NT equivalent of these is the RLE table. Because Unicode is a somewhat sparse mapping and real fonts are even sparser, there is a need to have the capability to return information about which glyphs are available in the font to GDISrv. This is done using the WCRUN structures defined in the winddi.h header file. To speed up CreateDC, RasDD uses these same structures in the minidriver. This means no time is spent building up tables that are static for a given printer.

The Windows NT DDK provides the ctt2rle tool to convert an existing Windows 3.1 CTT file to an NT RLE file. The conversion is done assuming that the Windows 3.1 character set provides the input mapping. The ctt2rle executable requires only a single parameter: the file containing the CTT data. The output is written to a file with the same prefix, but with a .rle extension. Similar to Unitool, ctt2rle uses the shortest format available to encode this information. The sample drivers in the DDK contain a batch file showing how ctt2rle.exe is used to convert existing files.