|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|
|TfmVisitor||Interface for a tfm visitor.|
|LoadableTfmFont||Class to load tfm fonts.|
|TfmCharInfoArray||Class for TFM char info.|
|TfmCharInfoWord||Class for TFM char info word.|
|TfmConstants||Constants for the TFM font.|
|TfmDepthArray||Class for TFM depth table.|
|TfmExtenArray||Class for TFM exten array.|
|TfmExtensibleRecipe||Class for extensible recipe.|
|TfmHeaderArray||Class for TFM header information.|
|TfmHeaderLengths||Class for TFM header length table.|
|TfmHeightArray||Class for TFM height table.|
|TfmIndexMultimap||TFMIndexMultimap can store and retrieve
|TfmItalicArray||Class for TFM italic table.|
|TfmKernArray||Class for TFM kern table.|
|TfmLigKernArray||Class for TFM lig/kern array.|
|TfmLigKernCommand||Class for a lig_kern_command.|
|TfmLigKernCommand.Activity||This is a type-safe class to represent activity information.|
|TfmParamArray||Class for TFM parameter table.|
|TfmReader||This class read a TFM-file.|
|TfmWidthArray||Class for TFM width table.|
|U2tFactory||Factory for the Unicode to tex font mapping.|
This package contains the definitions and implementations for the TFM-font-metric handling in ExTeX.
Definition of TFM format taken from TFtoPL 3.1 and
"The TUG DVI driver standards committee: DVI driver standard, level 0"
The information in a TFM file appears in a sequence of 8-bit bytes. Since the number of bytes is always a multiple of 4, we could also regard the file as a sequence of 32-bit words; but TeX uses the byte interpretation, and so do we. Note that the bytes are considered to be unsigned numbers.
|lf||length of the entire file, in words|
|lh||length of the header data, in words|
|bc||smallest character code in the font|
|ec||largest character code in the font|
|nw||number of words in the width table|
|nh||number of words in the height table|
|nd||number of words in the depth table|
|ni||number of words in the italic correction table|
|nl||number of words in the lig/kern table|
|nk||number of words in the kern table|
|ne||number of words in the extensible character table|
|np||number of font parameter words|
They are all nonnegative and less than 2^15.
We must have bc-1 < ec < 255, ne < 256, and
lf = 6 + lh + (ec-bc+1) + nw + nh + nd + ni + nl + nk + ne + np.
Note that a font may contain as many as 256 characters (if bc=0 and ec=255), and as few as 0 characters (if bc=ec+).
Incidentally, when two or more 8-bit bytes are combined to form an integer of 16 or more bits, the most significant bytes appear first in the file. This is called BigEndian order.
The rest of the TFM file may be regarded as a sequence of ten data arrays having the informal specification.
|header||array||0 to lh-1||of stuff|
|char_info||array||bc to ec||of char_info_word|
|width||array||0 to nw-1||of fix_word|
|height||array||0 to nh-1||of fix_word|
|depth||array||0 to nd-1||of fix_word|
|italic||array||0 to ni-1||of fix_word|
|lig_kern||array||0 to nl-1||of lig_kern_command|
|kern||array||0 to nk-1||of fix_word|
|exten||array||0 to ne-1||of extensible_recipe|
|param||array||1 to np||of fix_word|
The most important data type used here is a fix_word, which is a 32-bit representation of a binary fraction. A fix_word is a signed quantity, with the two's complement of the entire word used to represent negation. Of the 32 bits in a fix_word, exactly 12 are to the left of the binary point; thus, the largest fix_word value is 2048-2^-20, and the smallest is -2048. We will see below, however, that all but one of the fix_word values will lie between -16 and +16.
The first data array is a block of header information, which contains general facts about the font. The header must contain at least two words, and for TFM files to be used with Xerox printing software it must contain at least 18 words, allocated as described below. When different kinds of devices need to be interfaced, it may be necessary to add further words to the header block.
Next comes the char_info array, which contains one char_info_word per character. Each char_info_word contains six fields packed into four bytes as follows.
The actual width of a character is width}[width_index}], in design-size units; this is a device for compressing information, since many characters have the same width. Since it is quite common for many characters to have the same height, depth, or italic correction, the TFM format imposes a limit of 16 different heights, 16 different depths, and 64 different italic corrections.
Incidentally, the relation width=height=depth=italic=0 should always hold, so that an index of zero implies a value of zero. The width_index should never be zero unless the character does not exist in the font, since a character is valid if and only if it lies between bc and ec and has a nonzero width_index.
The tag field in a char_info_word} has four values that explain how to interpret the remainder field.
In a kern step, an additional space equal to kern[256(op_byte-128)+remainder] is inserted between the current character and next_char. This amount is often negative, so that the characters are brought closer together by kerning; but it might be positive.
There are eight kinds of ligature steps, having op_byte codes 4a+2b+c where 0 < a < b+c and 0 < b, c < 1. The character whose code is remainder is inserted between the current character and next_char; then the current character is deleted if b=0, and next_char is deleted if c=0; then we pass over a characters to reach the next current character (which may have a ligature/kerning program of its own).
Notice that if a=0 and b=1, the current character is unchanged; if a=b and c=1, the current character is changed but the next character is unchanged.
If the very first instruction of the lig_kern array has skip_byte=255, the next_char byte is the so-called right boundary character of this font; the value of next_char need not lie between bc and ec. If the very last instruction of the lig_kern array has skip_byte=255, there is a special ligature/kerning program for a left boundary character, beginning at location 256op_byte+remainder. The interpretation is that TeX puts implicit boundary characters before and after each consecutive string of characters from the same font. These implicit characters do not appear in the output, but they can affect ligatures and kerning.
If the very first instruction of a character's lig_kern program has skip_byte>128, the program actually begins in location 256op_byte+remainder. This feature allows access to large lig_kern arrays, because the first instruction must otherwise appear in a location <255.
Any instruction with skip_byte>128 in the lig_kern array must have 256op_byte+remainder<nl. If such an instruction is encountered during normal program execution, it denotes an unconditional halt; no ligature command is performed.
Extensible characters are specified by an extensible_recipe, which consists of four bytes called top, mid, bot, and rep (in this order). These bytes are the character codes of individual pieces used to build up a large symbol. If top, mid, or bot are zero, they are not present in the built-up result. For example, an extensible vertical line is like an extensible bracket, except that the top and bottom pieces are missing.
The final portion of a TFM file is the param array, which is another sequence of fix_word values.
When the character coding scheme is TeX math symbols, the font is supposed to have 15 additional parameters called num1, num2, num3, denom1, denom2, sup1, sup2, sup3, sub1, sub2, supdrop, subdrop, delim1, delim2, and axis_height, respectively. When the character coding scheme is TeX math extension, the font is supposed to have six additional parameters called default_rule_thickness and big_op_spacing1 through big_op_spacing5.
|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|