de.dante.extex.font.type.tfm
Class TFMLigKernArray

java.lang.Object
  extended byde.dante.extex.font.type.tfm.TFMLigKernArray
All Implemented Interfaces:
PlFormat, java.io.Serializable, XMLWriterConvertible

public class TFMLigKernArray
extends java.lang.Object
implements XMLWriterConvertible, PlFormat, java.io.Serializable

Class for TFM lig/kern array.

The array contains instructions in a simple programming language that explains what to do for special letter pairs. Each word is a lig_kern_command of four bytes.

bytedescription
first skip_byte, indicates that this is the final program step if the byte is 128 or more, otherwise the next step is obtained by skipping this number of intervening steps.
second next_char: if next_char follows the current character, then perform the operation and stop, otherwise continue.
third op_byte, indicates a ligature step if less than 128, a kern step otherwise.
fourth remainder

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.

Information from: The DVI Driver Standard, Level 0 The TUG DVI Driver Standards Committee

Version:
$Revision: 1.4 $
Author:
Michael Niedermair
See Also:
Serialized Form

Constructor Summary
TFMLigKernArray(RandomAccessR rar, short nl)
          Create a new object
 
Method Summary
 void calculate(TFMCharInfoArray chari, TFMKernArray akern, short abc)
          Calculate lig/kern
 short getBoundaryChar()
          Returns the boundaryChar.
 int getBoundaryStart()
          Returns the boundaryStart.
 TFMLigKernCommand[] getLigkerncommand()
          Returns the ligkerncommand.
 TFMLigKern[] getLigKernTable()
          Returns the ligKernTable.
 void toPL(PlWriter out)
          Print all information (jn PL-format) to the writer.
 void writeXML(XMLStreamWriter writer)
          Write the data to a XMLStreamWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TFMLigKernArray

public TFMLigKernArray(RandomAccessR rar,
                       short nl)
                throws java.io.IOException
Create a new object

Parameters:
rar - the input
nl - number of words in the lig/kern table
Throws:
java.io.IOException - if an IO-error occurs.
Method Detail

calculate

public void calculate(TFMCharInfoArray chari,
                      TFMKernArray akern,
                      short abc)
Calculate lig/kern

Parameters:
chari - the charinfo
akern - the kern
abc - smallest character code in the font

getLigkerncommand

public TFMLigKernCommand[] getLigkerncommand()
Returns the ligkerncommand.

Returns:
Returns the ligkerncommand.

getBoundaryChar

public short getBoundaryChar()
Returns the boundaryChar.

Returns:
Returns the boundaryChar.

getBoundaryStart

public int getBoundaryStart()
Returns the boundaryStart.

Returns:
Returns the boundaryStart.

getLigKernTable

public TFMLigKern[] getLigKernTable()
Returns the ligKernTable.

Returns:
Returns the ligKernTable.

toPL

public void toPL(PlWriter out)
          throws java.io.IOException
Description copied from interface: PlFormat
Print all information (jn PL-format) to the writer.

Specified by:
toPL in interface PlFormat
Parameters:
out - the plwriter
Throws:
java.io.IOException - if an IO-error occurs.
See Also:
PlFormat.toPL( de.dante.extex.font.type.PlWriter)

writeXML

public void writeXML(XMLStreamWriter writer)
              throws java.io.IOException
Description copied from interface: XMLWriterConvertible
Write the data to a XMLStreamWriter.

Specified by:
writeXML in interface XMLWriterConvertible
Parameters:
writer - the XML-Writer
Throws:
java.io.IOException - if an IO-error occurs.
See Also:
XMLWriterConvertible.writeXML(de.dante.util.xml.XMLStreamWriter)