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

All Methods Instance Methods Concrete Methods
`protected boolean` `allowCFF()`
`OpenTypeFont` `parse(File file)` Parse a file and return a TrueType font.
`OpenTypeFont` `parse(InputStream data)` Parse an input stream and return a TrueType font.
`OpenTypeFont` `parse(String file)` Parse a file and return a TrueType font.
`protected TTFTable` `readTable(TrueTypeFont font, 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(String file)
                       throws 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:
  `IOException` - If there is an error parsing the TrueType font.

#### parse

    public OpenTypeFont parse(File file)
                       throws 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:
  `IOException` - If there is an error parsing the TrueType font.

#### parse

    public OpenTypeFont parse(InputStream data)
                       throws 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:
  `IOException` - If there is an error parsing the TrueType font.

#### readTable

    protected TTFTable readTable(TrueTypeFont font,
                                 String tag)

Overrides:
  `readTable` in class `TTFParser`

#### allowCFF

    protected boolean allowCFF()

Overrides:
  `allowCFF` in class `TTFParser`