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 COSDictionary
private final COSDictionary
private final PDDocument
private static final org.apache.commons.logging.Log
private final PDType0Font
private final boolean
Fields 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 void
addNameTag
(String tag) private void
buildCIDSet
(Map<Integer, Integer> cidToGid) Builds the CIDSet entry, required by PDF/A.private void
buildCIDToGIDMap
(Map<Integer, Integer> cidToGid) protected void
buildSubset
(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) Rebuild a font subset.private void
buildToUnicodeCMap
(Map<Integer, Integer> newGIDToOldCID) private boolean
buildVerticalHeader
(COSDictionary cidFont) private void
buildVerticalMetrics
(Map<Integer, Integer> cidToGid) Builds vertical metrics with a custom CIDToGIDMap (for embedding font subset).private void
buildVerticalMetrics
(COSDictionary cidFont) Build vertical metrics with Identity CIDToGIDMap (for embedding full font).private void
buildWidths
(Map<Integer, Integer> cidToGid) Builds widths with a custom CIDToGIDMap (for embedding font subset).private void
buildWidths
(COSDictionary cidFont) Build widths with Identity CIDToGIDMap (for embedding full font).private COSDictionary
Returns the descendant CIDFont.private COSArray
getVerticalMetrics
(int[] values) private COSArray
getWidths
(int[] widths) private COSDictionary
toCIDSystemInfo
(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:
buildSubset
in 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
-