Package org.apache.pdfbox.pdmodel.font
Class PDTrueTypeFontEmbedder
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
-
- org.apache.pdfbox.pdmodel.font.PDTrueTypeFontEmbedder
-
- All Implemented Interfaces:
Subsetter
final class PDTrueTypeFontEmbedder extends TrueTypeEmbedder
Embedded PDTrueTypeFont builder. Helper class to populate a PDTrueTypeFont from a TTF.
-
-
Field Summary
Fields Modifier and Type Field Description private Encoding
fontEncoding
-
Fields inherited from class org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
cmap, cmapLookup, fontDescriptor, ttf
-
-
Constructor Summary
Constructors Constructor Description PDTrueTypeFontEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, Encoding encoding)
Creates a new TrueType font embedder for the given TTF as a PDTrueTypeFont.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildSubset(java.io.InputStream ttfSubset, java.lang.String tag, java.util.Map<java.lang.Integer,java.lang.Integer> gidToCid)
Rebuild a font subset.Encoding
getFontEncoding()
Returns the font's encoding.private void
setWidths(COSDictionary font, GlyphList glyphList)
Sets the glyph widths in the font dictionary.-
Methods inherited from class org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
addToSubset, buildFontFile2, getFontDescriptor, getTag, getTrueTypeFont, needsSubset, subset
-
-
-
-
Field Detail
-
fontEncoding
private final Encoding fontEncoding
-
-
Constructor Detail
-
PDTrueTypeFontEmbedder
PDTrueTypeFontEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, Encoding encoding) throws java.io.IOException
Creates a new TrueType font embedder for the given TTF as a PDTrueTypeFont.- Parameters:
document
- The parent documentdict
- Font dictionaryttfStream
- TTF streamencoding
- The PostScript encoding vector to be used for embedding.- Throws:
java.io.IOException
- if the TTF could not be read
-
-
Method Detail
-
setWidths
private void setWidths(COSDictionary font, GlyphList glyphList) throws java.io.IOException
Sets the glyph widths in the font dictionary.- Throws:
java.io.IOException
-
getFontEncoding
public Encoding getFontEncoding()
Returns the font's encoding.
-
buildSubset
protected void buildSubset(java.io.InputStream ttfSubset, java.lang.String tag, java.util.Map<java.lang.Integer,java.lang.Integer> gidToCid) throws java.io.IOException
Description copied from class:TrueTypeEmbedder
Rebuild a font subset.- Specified by:
buildSubset
in classTrueTypeEmbedder
- Throws:
java.io.IOException
-
-