public class CFFParser
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
CFFParser.ByteSource
Source from which bytes may be read in the future.
|
(package private) static class |
CFFParser.CFFBuiltInEncoding
Inner class representing a font's built-in CFF encoding.
|
private static class |
CFFParser.DictData
Inner class holding the DictData of a CFF font.
|
(package private) static class |
CFFParser.EmbeddedCharset
Inner class representing an embedded CFF charset.
|
private static class |
CFFParser.EmptyCharset
An empty charset in a malformed CID font.
|
private static class |
CFFParser.Format0Charset
Inner class representing a Format0 charset.
|
private static class |
CFFParser.Format0Encoding
Inner class representing a Format0 encoding.
|
private static class |
CFFParser.Format0FDSelect
Format 0 FDSelect.
|
private static class |
CFFParser.Format1Charset
Inner class representing a Format1 charset.
|
private static class |
CFFParser.Format1Encoding
Inner class representing a Format1 encoding.
|
private static class |
CFFParser.Format2Charset
Inner class representing a Format2 charset.
|
private static class |
CFFParser.Format3FDSelect
Format 3 FDSelect data.
|
private static class |
CFFParser.Header
Inner class holding the header of a CFF font.
|
private static class |
CFFParser.Range3
Structure of a Range3 element.
|
private static class |
CFFParser.RangeMapping
Inner class representing a rang mapping for a CID charset.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
debugFontName |
private static org.apache.commons.logging.Log |
LOG
Log instance.
|
private CFFParser.ByteSource |
source |
private java.lang.String[] |
stringIndex |
private static java.lang.String |
TAG_OTTO |
private static java.lang.String |
TAG_TTCF |
private static java.lang.String |
TAG_TTFONLY |
Constructor and Description |
---|
CFFParser() |
Modifier and Type | Method and Description |
---|---|
private void |
concatenateMatrix(java.util.List<java.lang.Number> matrixDest,
java.util.List<java.lang.Number> matrixConcat) |
private CFFDataInput |
createTaggedCFFDataInput(CFFDataInput input,
byte[] bytes) |
private java.lang.String |
getString(CFFParser.DictData dict,
java.lang.String name) |
java.util.List<CFFFont> |
parse(byte[] bytes)
Parse CFF font using a byte array as input.
|
java.util.List<CFFFont> |
parse(byte[] bytes,
CFFParser.ByteSource source)
Parse CFF font using byte array, also passing in a byte source for future use.
|
private void |
parseCIDFontDicts(CFFDataInput input,
CFFParser.DictData topDict,
CFFCIDFont font,
int nrOfcharStrings)
Parse dictionaries specific to a CIDFont.
|
private CFFFont |
parseFont(CFFDataInput input,
java.lang.String name,
byte[] topDictIndex) |
private void |
parseType1Dicts(CFFDataInput input,
CFFParser.DictData topDict,
CFFType1Font font,
CFFCharset charset)
Parse dictionaries specific to a Type 1-equivalent font.
|
private CFFCharset |
readCharset(CFFDataInput dataInput,
int nGlyphs,
boolean isCIDFont) |
private static CFFParser.DictData |
readDictData(CFFDataInput input) |
private static CFFParser.DictData |
readDictData(CFFDataInput input,
int dictSize) |
private CFFEncoding |
readEncoding(CFFDataInput dataInput,
CFFCharset charset) |
private static CFFParser.DictData.Entry |
readEntry(CFFDataInput input) |
private static FDSelect |
readFDSelect(CFFDataInput dataInput,
int nGlyphs,
CFFCIDFont ros)
Read the FDSelect Data according to the format.
|
private CFFParser.Format0Charset |
readFormat0Charset(CFFDataInput dataInput,
int format,
int nGlyphs,
boolean isCIDFont) |
private CFFParser.Format0Encoding |
readFormat0Encoding(CFFDataInput dataInput,
CFFCharset charset,
int format) |
private static CFFParser.Format0FDSelect |
readFormat0FDSelect(CFFDataInput dataInput,
int format,
int nGlyphs,
CFFCIDFont ros)
Read the Format 0 of the FDSelect data structure.
|
private CFFParser.Format1Charset |
readFormat1Charset(CFFDataInput dataInput,
int format,
int nGlyphs,
boolean isCIDFont) |
private CFFParser.Format1Encoding |
readFormat1Encoding(CFFDataInput dataInput,
CFFCharset charset,
int format) |
private CFFParser.Format2Charset |
readFormat2Charset(CFFDataInput dataInput,
int format,
int nGlyphs,
boolean isCIDFont) |
private static CFFParser.Format3FDSelect |
readFormat3FDSelect(CFFDataInput dataInput,
int format,
int nGlyphs,
CFFCIDFont ros)
Read the Format 3 of the FDSelect data structure.
|
private static CFFParser.Header |
readHeader(CFFDataInput input) |
private static byte[][] |
readIndexData(CFFDataInput input) |
private static int[] |
readIndexDataOffsets(CFFDataInput input) |
private static java.lang.Integer |
readIntegerNumber(CFFDataInput input,
int b0) |
private static long |
readLong(CFFDataInput input) |
private static CFFOperator |
readOperator(CFFDataInput input,
int b0) |
private static CFFOperator.Key |
readOperatorKey(CFFDataInput input,
int b0) |
private java.util.Map<java.lang.String,java.lang.Object> |
readPrivateDict(CFFParser.DictData privateDict) |
private static java.lang.Double |
readRealNumber(CFFDataInput input,
int b0) |
private java.lang.String |
readString(int index) |
private static java.lang.String[] |
readStringIndexData(CFFDataInput input) |
private void |
readSupplement(CFFDataInput dataInput,
CFFParser.CFFBuiltInEncoding encoding) |
private static java.lang.String |
readTagName(CFFDataInput input) |
java.lang.String |
toString() |
private static final org.apache.commons.logging.Log LOG
private static final java.lang.String TAG_OTTO
private static final java.lang.String TAG_TTCF
private static final java.lang.String TAG_TTFONLY
private java.lang.String[] stringIndex
private CFFParser.ByteSource source
private java.lang.String debugFontName
public java.util.List<CFFFont> parse(byte[] bytes, CFFParser.ByteSource source) throws java.io.IOException
bytes
- source bytessource
- source to re-read bytes from in the futurejava.io.IOException
- If there is an error reading from the streampublic java.util.List<CFFFont> parse(byte[] bytes) throws java.io.IOException
bytes
- the given byte arrayjava.io.IOException
- If there is an error reading from the streamprivate CFFDataInput createTaggedCFFDataInput(CFFDataInput input, byte[] bytes) throws java.io.IOException
java.io.IOException
private static java.lang.String readTagName(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static long readLong(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static CFFParser.Header readHeader(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static int[] readIndexDataOffsets(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static byte[][] readIndexData(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static java.lang.String[] readStringIndexData(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static CFFParser.DictData readDictData(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static CFFParser.DictData readDictData(CFFDataInput input, int dictSize) throws java.io.IOException
java.io.IOException
private static CFFParser.DictData.Entry readEntry(CFFDataInput input) throws java.io.IOException
java.io.IOException
private static CFFOperator readOperator(CFFDataInput input, int b0) throws java.io.IOException
java.io.IOException
private static CFFOperator.Key readOperatorKey(CFFDataInput input, int b0) throws java.io.IOException
java.io.IOException
private static java.lang.Integer readIntegerNumber(CFFDataInput input, int b0) throws java.io.IOException
java.io.IOException
private static java.lang.Double readRealNumber(CFFDataInput input, int b0) throws java.io.IOException
b0
- java.io.IOException
private CFFFont parseFont(CFFDataInput input, java.lang.String name, byte[] topDictIndex) throws java.io.IOException
java.io.IOException
private void concatenateMatrix(java.util.List<java.lang.Number> matrixDest, java.util.List<java.lang.Number> matrixConcat)
private void parseCIDFontDicts(CFFDataInput input, CFFParser.DictData topDict, CFFCIDFont font, int nrOfcharStrings) throws java.io.IOException
java.io.IOException
private java.util.Map<java.lang.String,java.lang.Object> readPrivateDict(CFFParser.DictData privateDict)
private void parseType1Dicts(CFFDataInput input, CFFParser.DictData topDict, CFFType1Font font, CFFCharset charset) throws java.io.IOException
java.io.IOException
private java.lang.String readString(int index)
private java.lang.String getString(CFFParser.DictData dict, java.lang.String name)
private CFFEncoding readEncoding(CFFDataInput dataInput, CFFCharset charset) throws java.io.IOException
java.io.IOException
private CFFParser.Format0Encoding readFormat0Encoding(CFFDataInput dataInput, CFFCharset charset, int format) throws java.io.IOException
java.io.IOException
private CFFParser.Format1Encoding readFormat1Encoding(CFFDataInput dataInput, CFFCharset charset, int format) throws java.io.IOException
java.io.IOException
private void readSupplement(CFFDataInput dataInput, CFFParser.CFFBuiltInEncoding encoding) throws java.io.IOException
java.io.IOException
private static FDSelect readFDSelect(CFFDataInput dataInput, int nGlyphs, CFFCIDFont ros) throws java.io.IOException
dataInput
- nGlyphs
- ros
- java.io.IOException
private static CFFParser.Format0FDSelect readFormat0FDSelect(CFFDataInput dataInput, int format, int nGlyphs, CFFCIDFont ros) throws java.io.IOException
dataInput
- format
- nGlyphs
- ros
- java.io.IOException
private static CFFParser.Format3FDSelect readFormat3FDSelect(CFFDataInput dataInput, int format, int nGlyphs, CFFCIDFont ros) throws java.io.IOException
dataInput
- format
- nGlyphs
- ros
- java.io.IOException
private CFFCharset readCharset(CFFDataInput dataInput, int nGlyphs, boolean isCIDFont) throws java.io.IOException
java.io.IOException
private CFFParser.Format0Charset readFormat0Charset(CFFDataInput dataInput, int format, int nGlyphs, boolean isCIDFont) throws java.io.IOException
java.io.IOException
private CFFParser.Format1Charset readFormat1Charset(CFFDataInput dataInput, int format, int nGlyphs, boolean isCIDFont) throws java.io.IOException
java.io.IOException
private CFFParser.Format2Charset readFormat2Charset(CFFDataInput dataInput, int format, int nGlyphs, boolean isCIDFont) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object