org.extex.font.format.pfb
Class PfbParser

java.lang.Object
  extended by org.extex.font.format.pfb.PfbParser
All Implemented Interfaces:
java.io.Serializable, XMLWriterConvertible

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

Parser for a pfb-file.

Adobe Type 1 BaseFont Format

see 2.2 BaseFont Dictionary

Type 1 BaseFont Program [ASCII - eexec encryption (Binary only) - ASCII]

TODO mgn: use RandomAccessR and put indexOf in it

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

Field Summary
static int C1
          C1.
static int C2
          C2.
static int CHARSTRING_R
          In charstring encryption, the initial key for the variable R is 4330 (decimal)
static int EEXEC_R
          In eexec encryption, the initial key for the variable R is 55665 (decimal).
 
Constructor Summary
PfbParser(byte[] data)
          Create a new object.
PfbParser(java.io.File file)
          Create a new object.
PfbParser(java.io.InputStream in)
          Create a new object.
PfbParser(java.lang.String filename)
          Create a new object.
 
Method Summary
 java.lang.String[] getAllGylyphNames()
          Returns all the glyph names in the font, or null, if not available.
 java.lang.String[] getEncoding()
          Returns the encoding (id - glyphanme).
 java.io.InputStream getInputStream()
          Returns the pfb data as stream.
 int[] getLengths()
          Returns the lengths.
 byte[] getPart(int idx)
          Returns the part of the array.
 byte[] getPfbdata()
          Returns the pfbdata (complete).
 int size()
          Returns the size of the pfb-data.
 void toPfa(java.io.OutputStream out)
          Write the data as pfa to the output stream.
 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
 

Field Detail

C1

public static final int C1
C1.

See Also:
Constant Field Values

C2

public static final int C2
C2.

See Also:
Constant Field Values

CHARSTRING_R

public static final int CHARSTRING_R
In charstring encryption, the initial key for the variable R is 4330 (decimal)

See Also:
Constant Field Values

EEXEC_R

public static final int EEXEC_R
In eexec encryption, the initial key for the variable R is 55665 (decimal).

See Also:
Constant Field Values
Constructor Detail

PfbParser

public PfbParser(byte[] data)
          throws FontException
Create a new object.

Parameters:
data - the data array.
Throws:
FontException - if an font error occurs.

PfbParser

public PfbParser(java.io.File file)
          throws FontException
Create a new object.

Parameters:
file - The input file.
Throws:
FontException - if an IO-error occurs.

PfbParser

public PfbParser(java.io.InputStream in)
          throws FontException
Create a new object.

Parameters:
in - The input.
Throws:
FontException - if an IO-error occurs.

PfbParser

public PfbParser(java.lang.String filename)
          throws FontException
Create a new object.

Parameters:
filename - the file name
Throws:
FontException - if an font error occurs.
Method Detail

getAllGylyphNames

public java.lang.String[] getAllGylyphNames()
Returns all the glyph names in the font, or null, if not available.

Returns:
Returns all the glyph names in the font.

getEncoding

public java.lang.String[] getEncoding()
Returns the encoding (id - glyphanme).

Returns:
Returns the encoding (id - glyphanme).

getInputStream

public java.io.InputStream getInputStream()
Returns the pfb data as stream.

Returns:
Returns the pfb data as stream.

getLengths

public int[] getLengths()
Returns the lengths.

Returns:
Returns the lengths.

getPart

public byte[] getPart(int idx)
Returns the part of the array.

Parameters:
idx - the part index.
Returns:
Returns the part of the array

getPfbdata

public byte[] getPfbdata()
Returns the pfbdata (complete).

Returns:
Returns the pfbdata (complete).

size

public int size()
Returns the size of the pfb-data.

Returns:
Returns the size of the pfb-data.

toPfa

public void toPfa(java.io.OutputStream out)
           throws java.io.IOException
Write the data as pfa to the output stream.

Parameters:
out - The output.
Throws:
java.io.IOException - if an IO-error occurs.

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(org.extex.util.xml.XMLStreamWriter)