Character-Translation Table File Formats
A character-translation table is used by RasDD to remap characters from the printer's native character and symbol set to the Windows ANSI set. RasDD will provide support for some of the common code pages and symbol sets, so that this data will not need to be redundant in a large number of individual printer drivers. It is intended that printer drivers supporting devices with less common code pages and symbol sets will contain their own character-translation table resources. Any given driver can mix and match either of these types of character-translation tables as needed. Character-translation tables provided by RasDD are referenced from the minidriver through negative numbers that correspond to the resource ID values (from RasDD), and character-translation tables provided by the minidriver are referenced by positive numbers corresponding to the resource ID values (from the minidriver).
Note For a Windows NT minidriver, the RLE format for glyph encoding is provided instead of the characterization tables to better support Unicode because there is no 256 entry limitation. This is particularly important for that translation of non-Latin based languages. The Windows NT DDK provides the CCT2RLE program that converts the Windows 3.1 CCT format to the preferred RLE format. This enables you to generate the RLE using the current CCT structure.
Predefined Translation Tables
RasDD will provide support for some of the common code pages and symbol sets, and allow drivers to support less common ones. The list of character-translation tables currently supported by RasDD is as follows:
Translation Table | Description |
CTT_CP437 | Translate using IBM Code Page 437. |
CTT_CP850 | Translate using IBM Code Page 850. |
CTT_WTYPE_BIG5 | Use for Big 5 to Big 5 conversions. |
CTT_WTYPE_CPJIS78 | Use to convert a range of single byte or double byte characters into JIS78. |
CTT_WTYPE_CPJIS83 | Use to convert a range of single byte or double byte characters into JIS83. |
CTT_WTYPE_CPJIS78_ANK | Use to convert a range of double byte characters into JIS78. |
CTT_WTYPE_CPJIS83_ANK | Use to convert a range of double byte characters into JIS83. |
CTT_WTYPE_NS86 | Use to convert Chinese Big 5 to Industrial Standard Code. |
TRANSTAB Structure
Three formats of character-translation tables are available. The first is a single byte-to-byte translation used for simple remappings. The second is a single byte-to-two bytes translation, where the second character is used to overstrike the first. The DI_BKSP_OK flag determines how the cursor should be repositioned to overstrike the second character. The third allows a single byte-to-variable length string that may contain commands to change symbol sets, or whatever else is necessary, to create the desired character. This difference between these formats is transparent to the user, but UniTool creates the character-translation table in the format resulting in the smallest file size depending upon the actual translations specified by the user. Any printer commands sent from the CTT cannot change the permanent state of the printer.
typedef struct {
WORD wType;
BYTE chFirstChar;
BYTE chLastChar;
union
{
short psCode[1];
BYTE bCode[1];
BYTE bPairs[2][1];
} uCode;
} TRANSTAB;
Members
wType
Translation table type. It can be one of these values:
Value | Meaning |
CTT_WTYPE_COMPOSE | uCode is an array of 16-bit offsets from the beginning of the file pointing to the strings to use for translation. The length of the translated string is the difference between the next offset and the current offset. Please note that an additional offset is needed (dfLastChar + 1) to provide a means to read the length of the string for the translation of the last character. |
CTT_WTYPE_DIRECT | uCode is a byte array of one-to-one translation table from chFirstChar to chLastChar. |
CTT_WTYPE_PAIRED | uCode contains an array of paired, unsigned bytes. If only one character is needed to do the translation, then the second byte is zero, otherwise the second byte is struck over the first byte. |
chFirstChar
First character in character-translation table.
chLastChar
Last character in character-translation table.