org.extex.font.format.vf.command
Class VfCommandCharacterPackets

java.lang.Object
  extended by org.extex.font.format.vf.command.VfCommand
      extended by org.extex.font.format.vf.command.VfCommandCharacterPackets
All Implemented Interfaces:
XMLWriterConvertible

public class VfCommandCharacterPackets
extends VfCommand

VfCommand: character packets

The preamble is followed by zero or more character packets, where each character packet begins with a byte that is <<243. Character packets have two formats, one long and one short:

    long_char  242     pl[4]  cc[4]   tfm[4]  dvi[pl]
 

This long form specifies a virtual character in the general case.

    short_char 0..241=pl[1]  cc[1]   tfm[3]  dvi[pl]
 

This short form specifies a virtual character in the common case when 0 <= pl <242 and 0 <= cc <256 and 0 < <= tfm < 2^24. The ccode is pl!

Here pl denotes the packet length following the tfm value; cc is the character code; and tfm is the character width copied from the TFM file for this virtual font. There should be at most one character packet having any given cc code.

The dvi bytes are a sequence of complete DVI commands, properly nested with respect to push and pop. All DVI operations are permitted except bop, eop, and commands with opcodes >=243. Font selection commands (fnt_num0 through fnt4) must refer to fonts defined in the preamble.

Dimensions that appear in the DVI instructions are analogous to fix_word quantities; i.e., they are integer multiples of 2^-20 times the design size of the virtual font. For example, if the virtual font has design size 10pt, the DVI command to move down 5pt would be a down instruction with parameter 2^19. The virtual font itself might be used at a different size, say 12pt; then that down instruction would move down 6pt instead. Each dimension must be less than 2^24 in absolute value.

Device drivers processing VF files treat the sequences of dvi bytes as subroutines or macros, implicitly enclosing them with push and pop. Each subroutine begins with w=x=y=z=0, and with current font f the number of the first-defined in the preamble (undefined if there's no such font). After the dvi commands have been performed, the h and v position registers of DVI format and the current font f are restored to their former values; then, if the subroutine has been invoked by a set_char or set command, h is increased by the TFM width (properly scaled) - just as if a simple character had been typeset.

Version:
$Revision: 7275 $
Author:
Michael Niedermair

Field Summary
 
Fields inherited from class org.extex.font.format.vf.command.VfCommand
FNT_DEF_1, FNT_DEF_2, FNT_DEF_3, FNT_DEF_4, MAX_CHARACTER, MIN_CHARACTER, POST, PRE, SHIFT16, SHIFT8
 
Constructor Summary
VfCommandCharacterPackets(Localizer localizer, RandomAccessR rar, int ccode)
          Creates a new object.
 
Method Summary
 int getCharactercode()
          Getter for charactercode.
 byte[] getDvi()
          Getter for dvi.
 int getPacketlength()
          Getter for packetlength.
 TfmFixWord getWidth()
          Getter for width.
 java.lang.String toString()
          
 void writeXML(XMLStreamWriter writer)
          Write the data to a XMLStreamWriter.
 
Methods inherited from class org.extex.font.format.vf.command.VfCommand
getCommandCode, getInstance, getLocalizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VfCommandCharacterPackets

public VfCommandCharacterPackets(Localizer localizer,
                                 RandomAccessR rar,
                                 int ccode)
                          throws FontException,
                                 java.io.IOException
Creates a new object.

Parameters:
localizer - The localizer.
rar - The input.
ccode - The command code.
Throws:
FontException - if a font error occurred.
java.io.IOException - if an IO-error occurred.
Method Detail

getCharactercode

public int getCharactercode()
Getter for charactercode.

Returns:
the charactercode

getDvi

public byte[] getDvi()
Getter for dvi.

Returns:
the dvi

getPacketlength

public int getPacketlength()
Getter for packetlength.

Returns:
the packetlength

getWidth

public TfmFixWord getWidth()
Getter for width.

Returns:
the width

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

writeXML

public void writeXML(XMLStreamWriter writer)
              throws java.io.IOException
Write the data to a XMLStreamWriter.

Parameters:
writer - the XML-Writer
Throws:
java.io.IOException - if an IO-error occurs.
See Also:
XMLWriterConvertible.writeXML( org.extex.util.xml.XMLStreamWriter)