Package org.apache.pdfbox.pdmodel.font
Class TrueTypeEmbedder
java.lang.Object
org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
- All Implemented Interfaces:
Subsetter
- Direct Known Subclasses:
PDCIDFontType2Embedder,PDTrueTypeFontEmbedder
Common functionality for embedding TrueType fonts.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprotected final CmapSubtableDeprecated.protected final CmapLookupprivate final PDDocumentprivate final booleanprotected PDFontDescriptorprivate static final intprivate static final intprotected TrueTypeFont -
Constructor Summary
ConstructorsConstructorDescriptionTrueTypeEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset) Creates a new TrueType font for embedding. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToSubset(int codePoint) Adds the given Unicode code point to this subset.voidbuildFontFile2(InputStream ttfStream) protected abstract voidbuildSubset(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) Rebuild a font subset.private PDFontDescriptorCreates a new font descriptor dictionary for the given TTF.Returns the font descriptor.Returns an uppercase 6-character unique tag for the given subset.Deprecated.(package private) booleanReturns true if the fsType in the OS/2 table permits embedding.private booleanReturns true if the fsType in the OS/2 table permits subsetting.booleanReturns true if the font needs to be subset.voidsubset()Subset this font now.
-
Field Details
-
ITALIC
private static final int ITALIC- See Also:
-
OBLIQUE
private static final int OBLIQUE- See Also:
-
BASE25
- See Also:
-
document
-
ttf
-
fontDescriptor
-
cmap
Deprecated.For API backwards compatibility. -
cmapLookup
-
subsetCodePoints
-
embedSubset
private final boolean embedSubset
-
-
Constructor Details
-
TrueTypeEmbedder
TrueTypeEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset) throws IOException Creates a new TrueType font for embedding.- Throws:
IOException
-
-
Method Details
-
buildFontFile2
- Throws:
IOException
-
isEmbeddingPermitted
Returns true if the fsType in the OS/2 table permits embedding.- Throws:
IOException
-
isSubsettingPermitted
Returns true if the fsType in the OS/2 table permits subsetting.- Throws:
IOException
-
createFontDescriptor
Creates a new font descriptor dictionary for the given TTF.- Throws:
IOException
-
getTrueTypeFont
Deprecated.Returns the FontBox font. -
getFontDescriptor
Returns the font descriptor. -
addToSubset
public void addToSubset(int codePoint) Description copied from interface:SubsetterAdds the given Unicode code point to this subset.- Specified by:
addToSubsetin interfaceSubsetter- Parameters:
codePoint- Unicode code point
-
subset
Description copied from interface:SubsetterSubset this font now.- Specified by:
subsetin interfaceSubsetter- Throws:
IOException- if the font could not be read
-
needsSubset
public boolean needsSubset()Returns true if the font needs to be subset. -
buildSubset
protected abstract void buildSubset(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) throws IOExceptionRebuild a font subset.- Throws:
IOException
-
getTag
Returns an uppercase 6-character unique tag for the given subset.
-