Class TTFParser

  • Direct Known Subclasses:
    OTFParser

    public class TTFParser
    extends java.lang.Object
    TrueType font file parser.
    Author:
    Ben Litchfield
    • Constructor Summary

      Constructors 
      Constructor Description
      TTFParser()
      Constructor.
      TTFParser​(boolean isEmbedded)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean allowCFF()  
      TrueTypeFont parse​(org.apache.pdfbox.io.RandomAccessRead randomAccessRead)
      Parse a RandomAccessRead and return a TrueType font.
      TrueTypeFont parseEmbedded​(java.io.InputStream inputStream)
      Parse an input stream and return a TrueType font that is to be embedded.
      FontHeaders parseTableHeaders​(org.apache.pdfbox.io.RandomAccessRead randomAccessRead)
      Parse a RandomAccessRead and return the table headers.
      protected TTFTable readTable​(java.lang.String tag)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TTFParser

        public TTFParser()
        Constructor.
      • TTFParser

        public TTFParser​(boolean isEmbedded)
        Constructor.
        Parameters:
        isEmbedded - true if the font is embedded in PDF
    • Method Detail

      • parse

        public TrueTypeFont parse​(org.apache.pdfbox.io.RandomAccessRead randomAccessRead)
                           throws java.io.IOException
        Parse a RandomAccessRead and return a TrueType font.
        Parameters:
        randomAccessRead - The RandomAccessRead to be read from. It will be closed before returning.
        Returns:
        A TrueType font.
        Throws:
        java.io.IOException - If there is an error parsing the TrueType font.
      • parseEmbedded

        public TrueTypeFont parseEmbedded​(java.io.InputStream inputStream)
                                   throws java.io.IOException
        Parse an input stream and return a TrueType font that is to be embedded.
        Parameters:
        inputStream - The TTF data stream to parse from. It will be closed before returning.
        Returns:
        A TrueType font.
        Throws:
        java.io.IOException - If there is an error parsing the TrueType font.
      • parseTableHeaders

        public FontHeaders parseTableHeaders​(org.apache.pdfbox.io.RandomAccessRead randomAccessRead)
                                      throws java.io.IOException
        Parse a RandomAccessRead and return the table headers.
        Parameters:
        randomAccessRead - The randomAccessRead to be read from. It will be closed before returning.
        Returns:
        TrueType font headers.
        Throws:
        java.io.IOException - If there is an error parsing the TrueType font.
      • allowCFF

        protected boolean allowCFF()
      • readTable

        protected TTFTable readTable​(java.lang.String tag)