Package org.apache.pdfbox.pdmodel.font
Class PDCIDFontType2Embedder
java.lang.Object
org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
org.apache.pdfbox.pdmodel.font.PDCIDFontType2Embedder
- All Implemented Interfaces:
Subsetter
Embedded PDCIDFontType2 builder. Helper class to populate a PDCIDFontType2 and its parent
PDType0Font from a TTF.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final COSDictionaryprivate final COSDictionaryprivate final PDDocumentprivate static final org.apache.commons.logging.Logprivate final PDType0Fontprivate final booleanFields inherited from class org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
cmap, cmapLookup, fontDescriptor, ttf -
Constructor Summary
ConstructorsConstructorDescriptionPDCIDFontType2Embedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset, PDType0Font parent, boolean vertical) Creates a new TrueType font embedder for the given TTF as a PDCIDFontType2. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddNameTag(String tag) private voidbuildCIDSet(TreeMap<Integer, Integer> cidToGid) Builds the CIDSet entry, required by PDF/A.private voidbuildCIDToGIDMap(TreeMap<Integer, Integer> cidToGid) protected voidbuildSubset(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) Rebuild a font subset.private voidbuildToUnicodeCMap(Map<Integer, Integer> newGIDToOldCID) private booleanbuildVerticalHeader(COSDictionary cidFont) private voidbuildVerticalMetrics(TreeMap<Integer, Integer> cidToGid) Builds vertical metrics with a custom CIDToGIDMap (for embedding font subset).private voidbuildVerticalMetrics(COSDictionary cidFont) Build vertical metrics with Identity CIDToGIDMap (for embedding full font).private voidbuildWidths(TreeMap<Integer, Integer> cidToGid) Builds widths with a custom CIDToGIDMap (for embedding font subset).private voidbuildWidths(COSDictionary cidFont) Build widths with Identity CIDToGIDMap (for embedding full font).private COSDictionaryReturns the descendant CIDFont.private COSArraygetVerticalMetrics(int[] values) private COSArraygetWidths(int[] widths) private COSDictionarytoCIDSystemInfo(String registry, String ordering, int supplement) Methods inherited from class org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
addToSubset, buildFontFile2, getFontDescriptor, getTag, getTrueTypeFont, isEmbeddingPermitted, needsSubset, subset
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
document
-
parent
-
dict
-
cidFont
-
vertical
private final boolean vertical
-
-
Constructor Details
-
PDCIDFontType2Embedder
PDCIDFontType2Embedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset, PDType0Font parent, boolean vertical) throws IOException Creates a new TrueType font embedder for the given TTF as a PDCIDFontType2.- Parameters:
document- parent documentdict- font dictionaryttf- True Type Fontparent- parent Type 0 font- Throws:
IOException- if the TTF could not be read
-
-
Method Details
-
buildSubset
protected void buildSubset(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) throws IOExceptionRebuild a font subset.- Specified by:
buildSubsetin classTrueTypeEmbedder- Throws:
IOException
-
buildToUnicodeCMap
- Throws:
IOException
-
toCIDSystemInfo
-
createCIDFont
- Throws:
IOException
-
addNameTag
-
buildCIDToGIDMap
- Throws:
IOException
-
buildCIDSet
Builds the CIDSet entry, required by PDF/A. This lists all CIDs in the font, including those that don't have a GID.- Throws:
IOException
-
buildWidths
Builds widths with a custom CIDToGIDMap (for embedding font subset).- Throws:
IOException
-
buildVerticalHeader
- Throws:
IOException
-
buildVerticalMetrics
Builds vertical metrics with a custom CIDToGIDMap (for embedding font subset).- Throws:
IOException
-
buildWidths
Build widths with Identity CIDToGIDMap (for embedding full font).- Throws:
IOException
-
getWidths
- Throws:
IOException
-
buildVerticalMetrics
Build vertical metrics with Identity CIDToGIDMap (for embedding full font).- Throws:
IOException
-
getVerticalMetrics
- Throws:
IOException
-
getCIDFont
Returns the descendant CIDFont.- Throws:
IOException
-