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

pack-priv final Class PDCIDFontType2Embedder

extends TrueTypeEmbedder
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, java.util.List, .Map, .Set, .TreeMap, org.apache.commons.logging.Log, .LogFactory, org.apache.fontbox.ttf.GlyphData, .GlyphTable, .HorizontalMetricsTable, .TrueTypeFont, .VerticalHeaderTable, .VerticalMetricsTable, org.apache.pdfbox.cos.COSArray, .COSDictionary, .COSInteger, .COSName, org.apache.pdfbox.pdmodel.PDDocument, org.apache.pdfbox.pdmodel.common.PDStream

Embedded PDCIDFontType2 builder. Helper class to populate a PDCIDFontType2 and its parent PDType0Font from a TTF.
Authors
Keiji Suzuki, John Hewson

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private final COSDictionary
private final COSDictionary
private final PDDocument
private static final Log
private final PDType0Font
private final boolean
Inherited from org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder:
cmapLookupfontDescriptorttf

Constructor Summary

AccessConstructor and Description
pack-priv
PDCIDFontType2Embedder(PDDocument
parent document
document
,
COSDictionary
font dictionary
dict
,
TrueTypeFont
True Type Font
ttf
,
boolean embedSubset, PDType0Font
parent Type 0 font
parent
,
boolean vertical)

Creates a new TrueType font embedder for the given TTF as a PDCIDFontType2.

Method Summary

Modifier and TypeMethod and Description
private void
private void
buildCIDSet(TreeMap<Integer, Integer> cidToGid)

Builds the CIDSet entry, required by PDF/A.

private void
protected void
buildSubset(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid)

Implements abstract org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.buildSubset.

Rebuild a font subset.

private void
private boolean
private void
buildVerticalMetrics(TreeMap<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(TreeMap<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
public PDCIDFont
getCIDFont()

Returns the descendant CIDFont.

private COSArray
getVerticalMetrics(int[] values)

private COSArray
getWidths(int[] widths)

private COSDictionary
toCIDSystemInfo(String registry, String ordering, int supplement)

Inherited from org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder:
addGlyphIdsaddToSubsetbuildFontFile2getFontDescriptorgetTagisEmbeddingPermittedneedsSubsetsubset

Field Detail

cidFontback to summary
private final COSDictionary cidFont
dictback to summary
private final COSDictionary dict
documentback to summary
private final PDDocument document

Hides org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.document.

LOGback to summary
private static final Log LOG
parentback to summary
private final PDType0Font parent
verticalback to summary
private final boolean vertical

Constructor Detail

PDCIDFontType2Embedderback to summary
pack-priv 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:PDDocument

parent document

dict:COSDictionary

font dictionary

ttf:TrueTypeFont

True Type Font

parent:PDType0Font

parent Type 0 font

Exceptions
IOException:
if the TTF could not be read

Method Detail

addNameTagback to summary
private void addNameTag(String tag)
buildCIDSetback to summary
private void buildCIDSet(TreeMap<Integer, Integer> cidToGid) throws IOException

Builds the CIDSet entry, required by PDF/A. This lists all CIDs in the font, including those that don't have a GID.

buildCIDToGIDMapback to summary
private void buildCIDToGIDMap(TreeMap<Integer, Integer> cidToGid) throws IOException
buildSubsetback to summary
protected void buildSubset(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) throws IOException

Implements abstract org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.buildSubset.

Rebuild a font subset.

Annotations
@Override
buildToUnicodeCMapback to summary
private void buildToUnicodeCMap(Map<Integer, Integer> newGIDToOldCID) throws IOException
buildVerticalHeaderback to summary
private boolean buildVerticalHeader(COSDictionary cidFont) throws IOException
buildVerticalMetricsback to summary
private void buildVerticalMetrics(TreeMap<Integer, Integer> cidToGid) throws IOException

Builds vertical metrics with a custom CIDToGIDMap (for embedding font subset).

buildVerticalMetricsback to summary
private void buildVerticalMetrics(COSDictionary cidFont) throws IOException

Build vertical metrics with Identity CIDToGIDMap (for embedding full font).

buildWidthsback to summary
private void buildWidths(TreeMap<Integer, Integer> cidToGid) throws IOException

Builds widths with a custom CIDToGIDMap (for embedding font subset).

buildWidthsback to summary
private void buildWidths(COSDictionary cidFont) throws IOException

Build widths with Identity CIDToGIDMap (for embedding full font).

createCIDFontback to summary
private COSDictionary createCIDFont() throws IOException
getCIDFontback to summary
public PDCIDFont getCIDFont() throws IOException

Returns the descendant CIDFont.

getVerticalMetricsback to summary
private COSArray getVerticalMetrics(int[] values) throws IOException
getWidthsback to summary
private COSArray getWidths(int[] widths) throws IOException
toCIDSystemInfoback to summary
private COSDictionary toCIDSystemInfo(String registry, String ordering, int supplement)
org.apache.pdfbox.pdmodel.font back to summary

pack-priv final Enum PDCIDFontType2Embedder.State

extends Enum<PDCIDFontType2Embedder.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final PDCIDFontType2Embedder.State
public static final PDCIDFontType2Embedder.State
public static final PDCIDFontType2Embedder.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PDCIDFontType2Embedder.State
public static PDCIDFontType2Embedder.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BRACKETback to summary
public static final PDCIDFontType2Embedder.State BRACKET
FIRSTback to summary
public static final PDCIDFontType2Embedder.State FIRST
SERIALback to summary
public static final PDCIDFontType2Embedder.State SERIAL

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static PDCIDFontType2Embedder.State valueOf(String name)
valuesback to summary
public static PDCIDFontType2Embedder.State[] values()