Class OpenTypeFont

java.lang.Object
org.apache.fontbox.ttf.TrueTypeFont
org.apache.fontbox.ttf.OpenTypeFont
All Implemented Interfaces:
Closeable, AutoCloseable, FontBoxFont

public class OpenTypeFont extends TrueTypeFont
An OpenType (OTF/TTF) font.
  • Field Details

    • isPostScript

      private boolean isPostScript
  • Constructor Details

    • OpenTypeFont

      OpenTypeFont(TTFDataStream fontData)
      Constructor. Clients should use the OTFParser to create a new OpenTypeFont object.
      Parameters:
      fontData - The font data.
  • Method Details

    • setVersion

      void setVersion(float versionValue)
      Description copied from class: TrueTypeFont
      Set the version. Package-private, used by TTFParser only.
      Overrides:
      setVersion in class TrueTypeFont
      Parameters:
      versionValue - The version to set.
    • getCFF

      public CFFTable getCFF() throws IOException
      Get the "CFF" table for this OTF.
      Returns:
      The "CFF" table.
      Throws:
      IOException
    • getGlyph

      public GlyphTable getGlyph() throws IOException
      Description copied from class: TrueTypeFont
      Get the glyf table for this TTF.
      Overrides:
      getGlyph in class TrueTypeFont
      Returns:
      The glyf table or null if it doesn't exist.
      Throws:
      IOException - if there was an error reading the table.
    • getPath

      public GeneralPath getPath(String name) throws IOException
      Description copied from interface: FontBoxFont
      Returns the path for the character with the given name.
      Specified by:
      getPath in interface FontBoxFont
      Overrides:
      getPath in class TrueTypeFont
      Returns:
      glyph path
      Throws:
      IOException - if the path could not be read
    • isPostScript

      public boolean isPostScript()
      Returns true if this font is a PostScript outline font.
    • hasLayoutTables

      public boolean hasLayoutTables()
      Returns true if this font uses OpenType Layout (Advanced Typographic) tables.