abstract class TrueTypeEmbedder extends java.lang.Object implements Subsetter
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
BASE25 |
protected CmapSubtable |
cmap
Deprecated.
|
protected CmapLookup |
cmapLookup |
private PDDocument |
document |
private boolean |
embedSubset |
protected PDFontDescriptor |
fontDescriptor |
private static int |
ITALIC |
private static int |
OBLIQUE |
private java.util.Set<java.lang.Integer> |
subsetCodePoints |
protected TrueTypeFont |
ttf |
Constructor and Description |
---|
TrueTypeEmbedder(PDDocument document,
COSDictionary dict,
TrueTypeFont ttf,
boolean embedSubset)
Creates a new TrueType font for embedding.
|
Modifier and Type | Method and Description |
---|---|
void |
addToSubset(int codePoint)
Adds the given Unicode code point to this subset.
|
void |
buildFontFile2(java.io.InputStream ttfStream) |
protected abstract void |
buildSubset(java.io.InputStream ttfSubset,
java.lang.String tag,
java.util.Map<java.lang.Integer,java.lang.Integer> gidToCid)
Rebuild a font subset.
|
private PDFontDescriptor |
createFontDescriptor(TrueTypeFont ttf)
Creates a new font descriptor dictionary for the given TTF.
|
PDFontDescriptor |
getFontDescriptor()
Returns the font descriptor.
|
java.lang.String |
getTag(java.util.Map<java.lang.Integer,java.lang.Integer> gidToCid)
Returns an uppercase 6-character unique tag for the given subset.
|
TrueTypeFont |
getTrueTypeFont()
Deprecated.
|
private boolean |
isEmbeddingPermitted(TrueTypeFont ttf)
Returns true if the fsType in the OS/2 table permits embedding.
|
private boolean |
isSubsettingPermitted(TrueTypeFont ttf)
Returns true if the fsType in the OS/2 table permits subsetting.
|
boolean |
needsSubset()
Returns true if the font needs to be subset.
|
void |
subset()
Subset this font now.
|
private static final int ITALIC
private static final int OBLIQUE
private static final java.lang.String BASE25
private final PDDocument document
protected TrueTypeFont ttf
protected PDFontDescriptor fontDescriptor
@Deprecated protected final CmapSubtable cmap
protected final CmapLookup cmapLookup
private final java.util.Set<java.lang.Integer> subsetCodePoints
private final boolean embedSubset
TrueTypeEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset) throws java.io.IOException
java.io.IOException
public void buildFontFile2(java.io.InputStream ttfStream) throws java.io.IOException
java.io.IOException
private boolean isEmbeddingPermitted(TrueTypeFont ttf) throws java.io.IOException
java.io.IOException
private boolean isSubsettingPermitted(TrueTypeFont ttf) throws java.io.IOException
java.io.IOException
private PDFontDescriptor createFontDescriptor(TrueTypeFont ttf) throws java.io.IOException
java.io.IOException
@Deprecated public TrueTypeFont getTrueTypeFont()
public PDFontDescriptor getFontDescriptor()
public void addToSubset(int codePoint)
Subsetter
addToSubset
in interface Subsetter
codePoint
- Unicode code pointpublic void subset() throws java.io.IOException
Subsetter
public boolean needsSubset()
protected abstract void buildSubset(java.io.InputStream ttfSubset, java.lang.String tag, java.util.Map<java.lang.Integer,java.lang.Integer> gidToCid) throws java.io.IOException
java.io.IOException
public java.lang.String getTag(java.util.Map<java.lang.Integer,java.lang.Integer> gidToCid)