java.lang.Object
org.sejda.sambox.pdmodel.font.TrueTypeEmbedder
- All Implemented Interfaces:
Subsetter
- Direct Known Subclasses:
PDCIDFontType2Embedder,PDTrueTypeFontEmbedder
Common functionality for embedding TrueType fonts.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.fontbox.ttf.CmapLookupprivate final booleanprotected PDFontDescriptorprivate static final intprivate static final intprotected org.apache.fontbox.ttf.TrueTypeFont -
Constructor Summary
ConstructorsConstructorDescriptionTrueTypeEmbedder(COSDictionary dict, org.apache.fontbox.ttf.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) private PDFontDescriptorcreateFontDescriptor(org.apache.fontbox.ttf.TrueTypeFont ttf) Creates a new font descriptor dictionary for the given TTF.Returns the font descriptor.org.apache.fontbox.ttf.TrueTypeFontDeprecated.booleanvoidsubset()Subset this font now.
-
Field Details
-
ITALIC
private static final int ITALIC- See Also:
-
OBLIQUE
private static final int OBLIQUE- See Also:
-
ttf
protected org.apache.fontbox.ttf.TrueTypeFont ttf -
fontDescriptor
-
cmapLookup
protected final org.apache.fontbox.ttf.CmapLookup cmapLookup -
subsetCodePoints
-
embedSubset
private final boolean embedSubset
-
-
Constructor Details
-
TrueTypeEmbedder
TrueTypeEmbedder(COSDictionary dict, org.apache.fontbox.ttf.TrueTypeFont ttf, boolean embedSubset) throws IOException Creates a new TrueType font for embedding.- Throws:
IOException
-
-
Method Details
-
buildFontFile2
- Throws:
IOException
-
createFontDescriptor
private PDFontDescriptor createFontDescriptor(org.apache.fontbox.ttf.TrueTypeFont ttf) throws IOException 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 IOException- Throws:
IOException
-