Package de.intarsys.cwt.font.afm
Class AFMParser
- java.lang.Object
-
- de.intarsys.cwt.font.afm.AFMParser
-
public class AFMParser extends java.lang.ObjectA simple parser for AFM type definition files.See the "Adobe Font Metrics File Format Specification"
-
-
Field Summary
Fields Modifier and Type Field Description static charCHAR_BSstatic charCHAR_CRstatic charCHAR_FFstatic charCHAR_HTstatic charCHAR_LFprotected static byte[]characterClassprotected static byteCHARCLASS_ANYprotected static byteCHARCLASS_DELIMITERprotected static byteCHARCLASS_DIGITprotected static byteCHARCLASS_NUMBERSPECIALprotected static byteCHARCLASS_TOKENprotected static byteCHARCLASS_WHITESPACE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanisEOL(int i)evaluate to true if i is a valid line terminator.static booleanisWhitespace(int i)evaluate to true if i is a valid whitespace.AFMparse(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 Detail
-
characterClass
protected static final byte[] characterClass
-
CHARCLASS_ANY
protected static final byte CHARCLASS_ANY
- See Also:
- Constant Field Values
-
CHARCLASS_DELIMITER
protected static final byte CHARCLASS_DELIMITER
- See Also:
- Constant Field Values
-
CHARCLASS_DIGIT
protected static final byte CHARCLASS_DIGIT
- See Also:
- Constant Field Values
-
CHARCLASS_NUMBERSPECIAL
protected static final byte CHARCLASS_NUMBERSPECIAL
- See Also:
- Constant Field Values
-
CHARCLASS_TOKEN
protected static final byte CHARCLASS_TOKEN
- See Also:
- Constant Field Values
-
CHARCLASS_WHITESPACE
protected static final byte CHARCLASS_WHITESPACE
- See Also:
- Constant Field Values
-
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 Detail
-
AFMParser
public AFMParser(AFM afm)
AFMParser constructor comment.
-
-
Method Detail
-
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
public AFM parse(de.intarsys.tools.randomaccess.IRandomAccess random) throws java.io.IOException
Parse aAFMobject from the input streamis.- Parameters:
is- The input stream containing the definition.- Returns:
- The
AFMparsed. - Throws:
java.io.IOException
-
read
protected void read(de.intarsys.tools.randomaccess.IRandomAccess random) throws java.io.IOException- Throws:
java.io.IOException
-
readBlock
protected byte[] readBlock(de.intarsys.tools.randomaccess.IRandomAccess random) throws java.io.IOExceptionignore this and any nested Start/End pair- Throws:
java.io.IOException
-
readCharMetrics
protected byte[] readCharMetrics(de.intarsys.tools.randomaccess.IRandomAccess random) throws java.io.IOException- Throws:
java.io.IOException
-
readFontMetrics
protected byte[] readFontMetrics(de.intarsys.tools.randomaccess.IRandomAccess random) throws java.io.IOException- Throws:
java.io.IOException
-
readLine
public byte[] readLine(de.intarsys.tools.randomaccess.IRandomAccess input) throws java.io.IOExceptionread a single line.- Returns:
- the array of characters belonging to the line
- Throws:
java.io.IOException
-
readLineElement
protected byte[] readLineElement(de.intarsys.tools.randomaccess.IRandomAccess input, int next) throws java.io.IOException- Throws:
java.io.IOException
-
readSpaces
public void readSpaces(de.intarsys.tools.randomaccess.IRandomAccess input) throws java.io.IOExceptionread 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:
java.io.IOException
-
readToken
public byte[] readToken(de.intarsys.tools.randomaccess.IRandomAccess input) throws java.io.IOExceptionread a single token.- Returns:
- the array of characters belonging to the token
- Throws:
java.io.IOException
-
readTokenElement
protected byte[] readTokenElement(de.intarsys.tools.randomaccess.IRandomAccess input, int next) throws java.io.IOException- Throws:
java.io.IOException
-
-