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
Embedded PDTrueTypeFont builder. Helper class to populate a PDTrueTypeFont from a TTF.
-
Field Summary
FieldsFields inherited from class org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder
cmap, cmapLookup, fontDescriptor, ttf
-
Constructor Summary
ConstructorsConstructorDescriptionPDTrueTypeFontEmbedder
(PDDocument document, COSDictionary dict, TrueTypeFont ttf, Encoding encoding) Creates a new TrueType font embedder for the given TTF as a PDTrueTypeFont. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
buildSubset
(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) Rebuild a font subset.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, isEmbeddingPermitted, needsSubset, subset
-
Field Details
-
fontEncoding
-
-
Constructor Details
-
PDTrueTypeFontEmbedder
PDTrueTypeFontEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, Encoding encoding) throws IOException Creates a new TrueType font embedder for the given TTF as a PDTrueTypeFont.- Parameters:
document
- The parent documentdict
- Font dictionaryttf
- TrueType fontencoding
- The PostScript encoding vector to be used for embedding.- Throws:
IOException
- if the TTF could not be read
-
-
Method Details
-
setWidths
Sets the glyph widths in the font dictionary.- Throws:
IOException
-
getFontEncoding
Returns the font's encoding. -
buildSubset
protected void buildSubset(InputStream ttfSubset, String tag, Map<Integer, Integer> gidToCid) throws IOExceptionDescription copied from class:TrueTypeEmbedder
Rebuild a font subset.- Specified by:
buildSubset
in classTrueTypeEmbedder
- Throws:
IOException
-