Top Description Inners Fields Constructors Methods
org.apache.pdfbox.pdmodel.font

public final Class PDFontFactory

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.charset.StandardCharsets, java.util.Arrays, .List, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSName, .COSStream, org.apache.pdfbox.io.RandomAccessRead, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.pdmodel.ResourceCache

Creates the appropriate font subtype based on information in the dictionary.
Author
Ben Litchfield

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private static final Log
private static final byte[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static PDCIDFont

Returns:

a PDCIDFont instance, based on the SubType entry of the dictionary
createDescendantFont
(COSDictionary
descendant font dictionary
dictionary
,
PDType0Font parent)

Creates a new PDCIDFont instance with the appropriate subclass.

public static PDFont

Returns:

a PDFont instance, based on the SubType entry of the dictionary
createFont
(COSDictionary
a font dictionary
dictionary
)

Creates a new PDFont instance with the appropriate subclass.

public static PDFont

Returns:

a PDFont instance, based on the SubType entry of the dictionary
createFont
(COSDictionary
a font dictionary
dictionary
,
ResourceCache
resource cache, only useful for type 3 fonts, can be null
resourceCache
)

Creates a new PDFont instance with the appropriate subclass.

private static void
fixType0Subtype(COSDictionary descendantFont, COSDictionary fontDescriptor, COSName newSubType)

private static COSDictionary
private static COSDictionary
private static byte[]
getFontHeader(COSDictionary fontDescriptor)

private static PDFontFactory.FontType
getFontTypeFromFont(COSDictionary fontDescriptor, COSName fontType)

private static boolean
isCFFFile(byte[] header)

private static boolean
isOpenTypeFile(byte[] header)

private static boolean
isPfbFile(byte[] header)

private static boolean
isTrueTypeCollectionFile(byte[] header)

private static boolean
isTrueTypeFile(byte[] header)

private static boolean
isType1File(byte[] header)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FONT_OPEN_TYPEback to summary
private static final String FONT_OPEN_TYPE
FONT_TRUE_TYPEback to summary
private static final String FONT_TRUE_TYPE
FONT_TTF_COLLECTIONback to summary
private static final String FONT_TTF_COLLECTION
FONT_TYPE1Cback to summary
private static final String FONT_TYPE1C
LOGback to summary
private static final Log LOG
TTF_HEADERback to summary
private static final byte[] TTF_HEADER

Constructor Detail

PDFontFactoryback to summary
private PDFontFactory()

Method Detail

createDescendantFontback to summary
pack-priv static PDCIDFont createDescendantFont(COSDictionary dictionary, PDType0Font parent) throws IOException

Creates a new PDCIDFont instance with the appropriate subclass.

Parameters
dictionary:COSDictionary

descendant font dictionary

Returns:PDCIDFont

a PDCIDFont instance, based on the SubType entry of the dictionary

Exceptions
IOException:
if something goes wrong
createFontback to summary
public static PDFont createFont(COSDictionary dictionary) throws IOException

Creates a new PDFont instance with the appropriate subclass.

Parameters
dictionary:COSDictionary

a font dictionary

Returns:PDFont

a PDFont instance, based on the SubType entry of the dictionary

Exceptions
IOException:
if something goes wrong
createFontback to summary
public static PDFont createFont(COSDictionary dictionary, ResourceCache resourceCache) throws IOException

Creates a new PDFont instance with the appropriate subclass.

Parameters
dictionary:COSDictionary

a font dictionary

resourceCache:ResourceCache

resource cache, only useful for type 3 fonts, can be null

Returns:PDFont

a PDFont instance, based on the SubType entry of the dictionary

Exceptions
IOException:
if something goes wrong
fixType0Subtypeback to summary
private static void fixType0Subtype(COSDictionary descendantFont, COSDictionary fontDescriptor, COSName newSubType)
getDescendantFontback to summary
private static COSDictionary getDescendantFont(COSDictionary dictionary)
getFontDescriptorback to summary
private static COSDictionary getFontDescriptor(COSDictionary dictionary)
getFontHeaderback to summary
private static byte[] getFontHeader(COSDictionary fontDescriptor) throws IOException
getFontTypeFromFontback to summary
private static PDFontFactory.FontType getFontTypeFromFont(COSDictionary fontDescriptor, COSName fontType) throws IOException
isCFFFileback to summary
private static boolean isCFFFile(byte[] header)
isOpenTypeFileback to summary
private static boolean isOpenTypeFile(byte[] header)
isPfbFileback to summary
private static boolean isPfbFile(byte[] header)
isTrueTypeCollectionFileback to summary
private static boolean isTrueTypeCollectionFile(byte[] header)
isTrueTypeFileback to summary
private static boolean isTrueTypeFile(byte[] header)
isType1Fileback to summary
private static boolean isType1File(byte[] header)
org.apache.pdfbox.pdmodel.font back to summary

private Class PDFontFactory.FontType

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final List<String>
private static final List<String>
private final COSName
private final COSName

Constructor Summary

AccessConstructor and Description
public
FontType(COSName type, String subtypeString)

public
FontType(COSName type, COSName subtype)

public

Method Summary

Modifier and TypeMethod and Description
public COSName
public boolean
isCIDSubtype(COSName cidSubtype)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cidType0Typesback to summary
private static final List<String> cidType0Types
cidType2Typesback to summary
private static final List<String> cidType2Types
subtypeback to summary
private final COSName subtype
typeback to summary
private final COSName type

Constructor Detail

FontTypeback to summary
public FontType(COSName type, String subtypeString)
FontTypeback to summary
public FontType(COSName type, COSName subtype)
FontTypeback to summary
public FontType(COSName type)

Method Detail

getSubtypeback to summary
public COSName getSubtype()
isCIDSubtypeback to summary
public boolean isCIDSubtype(COSName cidSubtype)