Package org.apache.pdfbox.pdmodel.font
Class PDFontFactory
java.lang.Object
org.apache.pdfbox.pdmodel.font.PDFontFactory
Creates the appropriate font subtype based on information in the dictionary.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static PDCIDFontcreateDescendantFont(COSDictionary dictionary, PDType0Font parent) Creates a new PDCIDFont instance with the appropriate subclass.static PDFontcreateFont(COSDictionary dictionary) Creates a new PDFont instance with the appropriate subclass.static PDFontcreateFont(COSDictionary dictionary, ResourceCache resourceCache) Creates a new PDFont instance with the appropriate subclass.private static voidfixType0Subtype(COSDictionary descendantFont, COSDictionary fontDescriptor, COSName newSubType) private static COSDictionarygetDescendantFont(COSDictionary dictionary) private static COSDictionarygetFontDescriptor(COSDictionary dictionary) private static byte[]getFontHeader(COSDictionary fontDescriptor) private static PDFontFactory.FontTypegetFontTypeFromFont(COSDictionary fontDescriptor, COSName fontType) private static booleanisCFFFile(byte[] header) private static booleanisOpenTypeFile(byte[] header) private static booleanisPfbFile(byte[] header) private static booleanisTrueTypeCollectionFile(byte[] header) private static booleanisTrueTypeFile(byte[] header) private static booleanisType1File(byte[] header)
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
FONT_TYPE1C
- See Also:
-
FONT_OPEN_TYPE
- See Also:
-
FONT_TTF_COLLECTION
- See Also:
-
FONT_TRUE_TYPE
- See Also:
-
TTF_HEADER
private static final byte[] TTF_HEADER
-
-
Constructor Details
-
PDFontFactory
private PDFontFactory()
-
-
Method Details
-
createFont
Creates a new PDFont instance with the appropriate subclass.- Parameters:
dictionary- a font dictionary- Returns:
- a PDFont instance, based on the SubType entry of the dictionary
- Throws:
IOException- if something goes wrong
-
createFont
public static PDFont createFont(COSDictionary dictionary, ResourceCache resourceCache) throws IOException Creates a new PDFont instance with the appropriate subclass.- Parameters:
dictionary- a font dictionaryresourceCache- resource cache, only useful for type 3 fonts, can be null- Returns:
- a PDFont instance, based on the SubType entry of the dictionary
- Throws:
IOException- if something goes wrong
-
fixType0Subtype
private static void fixType0Subtype(COSDictionary descendantFont, COSDictionary fontDescriptor, COSName newSubType) -
getFontTypeFromFont
private static PDFontFactory.FontType getFontTypeFromFont(COSDictionary fontDescriptor, COSName fontType) throws IOException - Throws:
IOException
-
isTrueTypeFile
private static boolean isTrueTypeFile(byte[] header) -
isTrueTypeCollectionFile
private static boolean isTrueTypeCollectionFile(byte[] header) -
isOpenTypeFile
private static boolean isOpenTypeFile(byte[] header) -
isType1File
private static boolean isType1File(byte[] header) -
isPfbFile
private static boolean isPfbFile(byte[] header) -
isCFFFile
private static boolean isCFFFile(byte[] header) -
getFontDescriptor
-
getDescendantFont
-
getFontHeader
- Throws:
IOException
-
createDescendantFont
static PDCIDFont createDescendantFont(COSDictionary dictionary, PDType0Font parent) throws IOException Creates a new PDCIDFont instance with the appropriate subclass.- Parameters:
dictionary- descendant font dictionary- Returns:
- a PDCIDFont instance, based on the SubType entry of the dictionary
- Throws:
IOException- if something goes wrong
-