Class PDTrueTypeFontEmbedder

  • All Implemented Interfaces:
    Subsetter

    final class PDTrueTypeFontEmbedder
    extends TrueTypeEmbedder
    Embedded PDTrueTypeFont builder. Helper class to populate a PDTrueTypeFont from a TTF.
    • 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 document
        dict - Font dictionary
        ttfStream - TTF stream
        encoding - 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 class TrueTypeEmbedder
        Throws:
        java.io.IOException