final class Type1Parser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int |
CHARSTRING_KEY |
private static int |
EEXEC_KEY |
private Type1Font |
font |
private Type1Lexer |
lexer |
Constructor and Description |
---|
Type1Parser() |
Modifier and Type | Method and Description |
---|---|
private java.util.List<java.lang.Number> |
arrayToNumbers(java.util.List<Token> value)
Extracts values from an array as numbers.
|
private byte[] |
decrypt(byte[] cipherBytes,
int r,
int n)
Type 1 Decryption (eexec, charstring).
|
private byte[] |
hexToBinary(byte[] bytes) |
private boolean |
isBinary(byte[] bytes) |
Type1Font |
parse(byte[] segment1,
byte[] segment2)
Parses a Type 1 font and returns a Type1Font class which represents it.
|
private void |
parseASCII(byte[] bytes)
Parses the ASCII portion of a Type 1 font.
|
private void |
parseBinary(byte[] bytes)
Parses the binary portion of a Type 1 font.
|
private Token |
read(Token.Kind kind)
Reads the next token and throws an error if it is not of the given kind.
|
private void |
read(Token.Kind kind,
java.lang.String name)
Reads the next token and throws an error if it is not of the given kind
and does not have the given value.
|
private void |
readCharStrings(int lenIV)
Reads the /CharStrings dictionary.
|
private void |
readDef()
Reads the sequence "noaccess def" or equivalent.
|
private java.util.List<Token> |
readDictValue()
Reads a simple value from a dictionary.
|
private void |
readEncoding() |
private void |
readFontInfo(java.util.Map<java.lang.String,java.util.List<Token>> fontInfo)
Extracts values from the /FontInfo dictionary.
|
private Token |
readMaybe(Token.Kind kind,
java.lang.String name)
Reads the next token if and only if it is of the given kind and
has the given value.
|
private void |
readOtherSubrs() |
private void |
readPostScriptWrapper(java.util.List<Token> value) |
private void |
readPrivate(java.lang.String key,
java.util.List<Token> value)
Extracts values from the /Private dictionary.
|
private java.util.List<Token> |
readProc()
Reads a procedure.
|
private void |
readPut()
Reads the sequence "noaccess put" or equivalent.
|
private java.util.Map<java.lang.String,java.util.List<Token>> |
readSimpleDict()
Reads a dictionary whose values are simple, i.e., do not contain
nested dictionaries.
|
private void |
readSimpleValue(java.lang.String key) |
private void |
readSubrs(int lenIV)
Reads the /Subrs array.
|
private java.util.List<Token> |
readValue()
Reads a simple value.
|
private static final int EEXEC_KEY
private static final int CHARSTRING_KEY
private Type1Lexer lexer
private Type1Font font
public Type1Font parse(byte[] segment1, byte[] segment2) throws java.io.IOException
segment1
- Segment 1: ASCIIsegment2
- Segment 2: Binaryjava.io.IOException
private void parseASCII(byte[] bytes) throws java.io.IOException
java.io.IOException
private void readSimpleValue(java.lang.String key) throws java.io.IOException
java.io.IOException
private void readEncoding() throws java.io.IOException
java.io.IOException
private java.util.List<java.lang.Number> arrayToNumbers(java.util.List<Token> value) throws java.io.IOException
java.io.IOException
private void readFontInfo(java.util.Map<java.lang.String,java.util.List<Token>> fontInfo)
private java.util.Map<java.lang.String,java.util.List<Token>> readSimpleDict() throws java.io.IOException
java.io.IOException
private java.util.List<Token> readDictValue() throws java.io.IOException
java.io.IOException
private java.util.List<Token> readValue() throws java.io.IOException
java.io.IOException
private void readPostScriptWrapper(java.util.List<Token> value) throws java.io.IOException
java.io.IOException
private java.util.List<Token> readProc() throws java.io.IOException
java.io.IOException
private void parseBinary(byte[] bytes) throws java.io.IOException
java.io.IOException
private void readPrivate(java.lang.String key, java.util.List<Token> value) throws java.io.IOException
java.io.IOException
private void readSubrs(int lenIV) throws java.io.IOException
lenIV
- The number of random bytes used in charstring encryption.java.io.IOException
private void readOtherSubrs() throws java.io.IOException
java.io.IOException
private void readCharStrings(int lenIV) throws java.io.IOException
lenIV
- The number of random bytes used in charstring encryption.java.io.IOException
private void readDef() throws java.io.IOException
java.io.IOException
private void readPut() throws java.io.IOException
java.io.IOException
private Token read(Token.Kind kind) throws java.io.IOException
java.io.IOException
private void read(Token.Kind kind, java.lang.String name) throws java.io.IOException
java.io.IOException
private Token readMaybe(Token.Kind kind, java.lang.String name) throws java.io.IOException
java.io.IOException
private byte[] decrypt(byte[] cipherBytes, int r, int n)
cipherBytes
- cipher textr
- keyn
- number of random bytes (lenIV)private boolean isBinary(byte[] bytes)
private byte[] hexToBinary(byte[] bytes)