Package org.apache.fontbox.ttf
Class TTFParser
java.lang.Object
org.apache.fontbox.ttf.TTFParser
- Direct Known Subclasses:
OTFParser
TrueType font file parser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final org.apache.commons.logging.Log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanallowCFF()private TrueTypeFontParse a file and get a true type font.(package private) TrueTypeFontnewFont(TTFDataStream raf) (package private) TrueTypeFontparse(TTFDataStream raf) parse(RandomAccessRead randomAccessRead) Parse a RandomAccessRead and return a TrueType font.parseEmbedded(InputStream inputStream) Parse an input stream and return a TrueType font that is to be embedded.(package private) FontHeadersBased on.invalid reference
#parseTables()parseTableHeaders(RandomAccessRead randomAccessRead) Parse a RandomAccessRead and return the table headers.private voidparseTables(TrueTypeFont font) Parse all tables and check if all needed tables are present.protected TTFTableprivate TTFTable
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
isEmbedded
private boolean isEmbedded
-
-
Constructor Details
-
TTFParser
public TTFParser()Constructor. -
TTFParser
public TTFParser(boolean isEmbedded) Constructor.- Parameters:
isEmbedded- true if the font is embedded in PDF
-
-
Method Details
-
parse
Parse a RandomAccessRead and return a TrueType font.- Parameters:
randomAccessRead- The RandomAccessRead to be read from. It will be closed before returning.- Returns:
- A TrueType font.
- Throws:
IOException- If there is an error parsing the TrueType font.
-
parseEmbedded
Parse an input stream and return a TrueType font that is to be embedded.- Parameters:
inputStream- The TTF data stream to parse from. It will be closed before returning.- Returns:
- A TrueType font.
- Throws:
IOException- If there is an error parsing the TrueType font.
-
parseTableHeaders
Parse a RandomAccessRead and return the table headers.- Parameters:
randomAccessRead- The randomAccessRead to be read from. It will be closed before returning.- Returns:
- TrueType font headers.
- Throws:
IOException- If there is an error parsing the TrueType font.
-
createFontWithTables
Parse a file and get a true type font.- Parameters:
raf- The TTF file.- Returns:
- A TrueType font.
- Throws:
IOException- If there is an error parsing the TrueType font.
-
parse
- Throws:
IOException
-
newFont
-
parseTables
Parse all tables and check if all needed tables are present.- Parameters:
font- the TrueTypeFont instance holding the parsed data.- Throws:
IOException- If there is an error parsing the TrueType font.
-
parseTableHeaders
Based on. Parse all table headers and check if all needed tables are present. This method can be optimized further by skipping unused portions inside each individual table parserinvalid reference
#parseTables()- Parameters:
raf- the TrueType data stream.- Throws:
IOException- If there is an error parsing the TrueType font.
-
allowCFF
protected boolean allowCFF() -
readTableDirectory
- Throws:
IOException
-
readTable
-