The fonts that are used here provide only the basic characters—vowels, consonants (both full and half forms), special forms, and, some ligatures. Every letter is built by printing its constituent characters. This mapping of the consonant-vowel pairs, of the ligatures, etc, to actual characters to be used from the specific font is specified through the IFM file (indian language font metric file). The IFM file is a text file, and follows somewhat the syntax of Adobe AFM files. In it is described how to construct every consonant-vowel form using the given font, how to construct a ligature of consonant-consonant pairs, the character codes of the special forms, etc. The description is provided as a list of character codes, and their offsets. For example a description for some letter looks like:
PCC 97 0 0 ; PCC 129 -70 0 ;
This is a two character chain, first character has code 97, second character has a code of 129. The first character is printed with an offset (x,y) of (0,0). Then the second character is printed with an offset of (-70,0), i.e., a kern of -70 units. One unit is equivalent of 1/1000 of the current font size. The entire IFM file structure is described in a later section.
As shown in the example above, the chain of characters is printed out by performing two operations on every character code in the chain:
for every component of the form: PCC <code> <dx> <dy> ; move <dx>, <dy>; display character <code>; /*POSTSCRIPT FONT ONLY*/ if (<dy> is non-zero) move 0, -<dy>; if (width of char <code> is defined as zero) move -<dx>, 0; /*POSTSCRIPT FONT ONLY*/
This relies on the fact that both TEX and PostScript have a notion of a
current point.
Two values allow kerning to be specified in both X and Y directions.
If a movement in Y direction is des
Note that if the font being used is a PostScript font, then two other
actions may be performed.
If <dy>
is non-zero, itrans reapplies a negative offset to
restore the baseline y coordinate (otherwise the line will keep getting
skewed! Note that this step is not necessary for TEX—it takes care
of keeping the baseline horizontal).
Secondly, if the width of the character has been defined to be zero, a
negative x kern is applied.
This is done just for convenience—zero width characters are always
used as accent marks, and they should not contribute to the actual
character width, so the current position in X is restored to the original
value after a accent mark (zero width character) is printed.
Only PostScript fonts may have zero-width characters, the above does not apply to TEX Matafont fonts. I.e, for TEX, the last move -<dx>, 0; is never executed, even if the charwidth for the given character is zero. (This is partly due to my laziness, I did not want to write code that reads in a TFM file to get the char widths!)
The above given description is used to specify both consonant-vowel forms, and consonant-consonant (ligature) forms. Currently, only ligatures composed of two consonants can be defined.
If a consonant-vowel form appears in the input text, but has not been defined in the IFM file, an error message is printed on the screen, and the character is omitted.
If a consonant-consonant-vowel (ligature) form appears in the input text, but has not been defined in the IFM file, it is not considered an error, instead, the first consonant is printed in the half-form, and the second consonant is printed out as its appropriate vowel form. Long consonant chains, such as consonant-consonant- ... -consonant-vowel are also handled in a similar manner—first a check if made if a ligature exists for any two consecutive consonants, if yes, it is used, else, the half forms of the consonants are used. Beginning with the first consonant in the list, itrans checks if a double-consonant ligature has been defined for that consonant and the next one in the list. If such a character exists, then it is used and both consonants are consumed, and itrans repeats the procedure for the next consonant.
There is an exception to the above rule: if at all possible, the last two consonants are handled together, that is if a ligature of the last two consonants exists, that is used over the pairing that would result from the above method. (See the user manual idoc.itx for example in the section Usage Hints.)