Package de.intarsys.cwt.font.afm
Class AFMParser
java.lang.Object
de.intarsys.cwt.font.afm.AFMParser
A simple parser for AFM type definition files.
See the "Adobe Font Metrics File Format Specification"
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic charstatic charstatic charstatic charstatic charprotected static final byte[]protected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byte -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final booleanisEOL(int i) evaluate to true if i is a valid line terminator.static final booleanisWhitespace(int i) evaluate to true if i is a valid whitespace.parse(de.intarsys.tools.randomaccess.IRandomAccess random) Parse aAFMobject from the input streamis.protected voidread(de.intarsys.tools.randomaccess.IRandomAccess random) protected byte[]readBlock(de.intarsys.tools.randomaccess.IRandomAccess random) ignore this and any nested Start/End pairprotected byte[]readCharMetrics(de.intarsys.tools.randomaccess.IRandomAccess random) protected byte[]readFontMetrics(de.intarsys.tools.randomaccess.IRandomAccess random) byte[]readLine(de.intarsys.tools.randomaccess.IRandomAccess input) read a single line.protected byte[]readLineElement(de.intarsys.tools.randomaccess.IRandomAccess input, int next) voidreadSpaces(de.intarsys.tools.randomaccess.IRandomAccess input) read all characters until EOF or non space char appears.byte[]readToken(de.intarsys.tools.randomaccess.IRandomAccess input) read a single token.protected byte[]readTokenElement(de.intarsys.tools.randomaccess.IRandomAccess input, int next)
-
Field Details
-
characterClass
protected static final byte[] characterClass -
CHARCLASS_ANY
protected static final byte CHARCLASS_ANY- See Also:
-
CHARCLASS_DELIMITER
protected static final byte CHARCLASS_DELIMITER- See Also:
-
CHARCLASS_DIGIT
protected static final byte CHARCLASS_DIGIT- See Also:
-
CHARCLASS_NUMBERSPECIAL
protected static final byte CHARCLASS_NUMBERSPECIAL- See Also:
-
CHARCLASS_TOKEN
protected static final byte CHARCLASS_TOKEN- See Also:
-
CHARCLASS_WHITESPACE
protected static final byte CHARCLASS_WHITESPACE- See Also:
-
CHAR_BS
public static char CHAR_BS -
CHAR_CR
public static char CHAR_CR -
CHAR_FF
public static char CHAR_FF -
CHAR_HT
public static char CHAR_HT -
CHAR_LF
public static char CHAR_LF
-
-
Constructor Details
-
AFMParser
AFMParser constructor comment.
-
-
Method Details
-
isEOL
public static final boolean isEOL(int i) evaluate to true if i is a valid line terminator.- Parameters:
i- i a byte representation- Returns:
- true if i is a valid line terminator
-
isWhitespace
public static final boolean isWhitespace(int i) evaluate to true if i is a valid whitespace.- Parameters:
i- i a byte representation- Returns:
- true if i is a valid whitespace
-
parse
Parse aAFMobject from the input streamis.- Parameters:
is- The input stream containing the definition.- Returns:
- The
AFMparsed. - Throws:
IOException
-
read
- Throws:
IOException
-
readBlock
ignore this and any nested Start/End pair- Throws:
IOException
-
readCharMetrics
protected byte[] readCharMetrics(de.intarsys.tools.randomaccess.IRandomAccess random) throws IOException - Throws:
IOException
-
readFontMetrics
protected byte[] readFontMetrics(de.intarsys.tools.randomaccess.IRandomAccess random) throws IOException - Throws:
IOException
-
readLine
read a single line.- Returns:
- the array of characters belonging to the line
- Throws:
IOException
-
readLineElement
protected byte[] readLineElement(de.intarsys.tools.randomaccess.IRandomAccess input, int next) throws IOException - Throws:
IOException
-
readSpaces
read all characters until EOF or non space char appears. the first non space char is pushed back so the next char read is the first non space char.- Throws:
IOException
-
readToken
read a single token.- Returns:
- the array of characters belonging to the token
- Throws:
IOException
-
readTokenElement
protected byte[] readTokenElement(de.intarsys.tools.randomaccess.IRandomAccess input, int next) throws IOException - Throws:
IOException
-