de.dante.extex.font.type.vf.command
Class VFCommandCharacterPackets

java.lang.Object
  extended byde.dante.extex.font.type.vf.command.VFCommand
      extended byde.dante.extex.font.type.vf.command.VFCommandCharacterPackets
All Implemented Interfaces:
PlFormat, XMLWriterConvertible

public class VFCommandCharacterPackets
extends VFCommand
implements PlFormat

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: 1.11 $
Author:
Michael Niedermair

Field Summary
 
Fields inherited from class de.dante.extex.font.type.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(RandomAccessR rar, int ccode, FontFactory fontfac, java.util.Map fontm, TFMFont mtfm)
          Create e new object.
 
Method Summary
 void addGlyph(org.jdom.Element element)
          Add glyph to the element
 int getCharactercode()
          Returns the charactercode.
 byte[] getDvi()
          Returns the dvi.
 int getPacketlength()
          Returns the packetlength.
 TFMFixWord getWidth()
          Returns the width.
 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 de.dante.extex.font.type.vf.command.VFCommand
getCommandCode, getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VFCommandCharacterPackets

public VFCommandCharacterPackets(RandomAccessR rar,
                                 int ccode,
                                 FontFactory fontfac,
                                 java.util.Map fontm,
                                 TFMFont mtfm)
                          throws java.io.IOException,
                                 FontException
Create e new object.

Parameters:
rar - the input
ccode - the command code
fontfac - the font factory
fontm - the fontmap
mtfm - the master tfm
Throws:
java.io.IOException - if a IO-error occured
FontException - if a error reading the font.
Method Detail

getCharactercode

public int getCharactercode()
Returns the charactercode.

Returns:
Returns the charactercode.

getDvi

public byte[] getDvi()
Returns the dvi.

Returns:
Returns the dvi.

getPacketlength

public int getPacketlength()
Returns the packetlength.

Returns:
Returns the packetlength.

getWidth

public TFMFixWord getWidth()
Returns the width.

Returns:
Returns the width.

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)

toPL

public void toPL(PlWriter out)
          throws java.io.IOException,
                 FontException
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.
FontException - if a font-error occurs.
See Also:
PlFormat.toPL( de.dante.extex.font.type.PlWriter)

addGlyph

public void addGlyph(org.jdom.Element element)
              throws FontException
Add glyph to the element

Parameters:
element - the element
Throws:
FontException - if a font-error occurs.