OTFParser
Date: 2017-05-25

org.apache.fontbox.ttf

## Class OTFParser

- java.lang.Object
- - org.apache.fontbox.ttf.TTFParser
  - - org.apache.fontbox.ttf.OTFParser

-     public final class OTFParser
      extends TTFParser

  OpenType font file parser.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OTFParser()` Constructor.
    `OTFParser(boolean isEmbedded)` Constructor.
    `OTFParser(boolean isEmbedded, boolean parseOnDemand)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `allowCFF()`
    `OpenTypeFont` | `parse(java.io.File file)` Parse a file and return a TrueType font.
    `OpenTypeFont` | `parse(java.io.InputStream data)` Parse an input stream and return a TrueType font.
    `OpenTypeFont` | `parse(java.lang.String file)` Parse a file and return a TrueType font.
    `protected TTFTable` | `readTable(TrueTypeFont font, java.lang.String tag)`

    - ### Methods inherited from class org.apache.fontbox.ttf.TTFParser

      `parseEmbedded`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OTFParser

          public OTFParser()

      Constructor.

    - #### OTFParser

          public OTFParser(boolean isEmbedded)

      Constructor.
      Parameters:
        `isEmbedded` - true if the font is embedded in PDF

    - #### OTFParser

          public OTFParser(boolean isEmbedded,
                   boolean parseOnDemand)

      Constructor.
      Parameters:
        `isEmbedded` - true if the font is embedded in PDF
        `parseOnDemand` - true if the tables of the font should be parsed on demand

  - ### Method Detail

    - #### parse

          public OpenTypeFont parse(java.lang.String file)
                             throws java.io.IOException

      Description copied from class: `TTFParser`
      Parse a file and return a TrueType font.
      Overrides:
        `parse` in class `TTFParser`
      Parameters:
        `file` - The TrueType font filename.
      Returns:
        A TrueType font.
      Throws:
        `java.io.IOException` - If there is an error parsing the TrueType font.

    - #### parse

          public OpenTypeFont parse(java.io.File file)
                             throws java.io.IOException

      Description copied from class: `TTFParser`
      Parse a file and return a TrueType font.
      Overrides:
        `parse` in class `TTFParser`
      Parameters:
        `file` - The TrueType font file.
      Returns:
        A TrueType font.
      Throws:
        `java.io.IOException` - If there is an error parsing the TrueType font.

    - #### parse

          public OpenTypeFont parse(java.io.InputStream data)
                             throws java.io.IOException

      Description copied from class: `TTFParser`
      Parse an input stream and return a TrueType font.
      Overrides:
        `parse` in class `TTFParser`
      Parameters:
        `data` - 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.

    - #### readTable

          protected TTFTable readTable(TrueTypeFont font,
                           java.lang.String tag)

      Overrides:
        `readTable` in class `TTFParser`

    - #### allowCFF

          protected boolean allowCFF()

      Overrides:
        `allowCFF` in class `TTFParser`