2 TRANSTAB Structure
There are three formats of character-translation tables available for use.
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; // indicates type of translation table.
BYTE chFirstChar;
BYTE chLastChar;
union
{
short psCode[1];
BYTE bCode[1];
BYTE bPairs[2][1];
} uCode;
} TRANSTAB;
Member Description
---------------------------------------------------------------------------
wType Specifies the type of translation table.
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.