CFFFont
Date: 2017-05-25

org.apache.fontbox.cff

## Class CFFFont

- java.lang.Object
- - org.apache.fontbox.cff.CFFFont

- All Implemented Interfaces:
    FontBoxFont
  Direct Known Subclasses:
    CFFCIDFont, CFFType1Font

      public abstract class CFFFont
      extends java.lang.Object
      implements FontBoxFont

  An Adobe Compact Font Format (CFF) font. Thread safe.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CFFCharset` | `charset`
    `protected byte[][]` | `charStrings`
    `protected java.lang.String` | `fontName`
    `protected byte[][]` | `globalSubrIndex`
    `protected java.util.Map<java.lang.String,java.lang.Object>` | `topDict`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CFFFont()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addValueToTopDict(java.lang.String name, java.lang.Object value)` Adds the given key/value pair to the top dictionary.
    `CFFCharset` | `getCharset()` Returns the CFFCharset of the font.
    `java.util.List<byte[]>` | `getCharStringBytes()` Returns the character strings dictionary.
    `byte[]` | `getData()` Returns the CFF data.
    `BoundingBox` | `getFontBBox()` Returns the FontBBox.
    `abstract java.util.List<java.lang.Number>` | `getFontMatrix()` Returns the FontMatrix.
    `java.util.List<byte[]>` | `getGlobalSubrIndex()` Returns the list containing the global subroutine .
    `java.lang.String` | `getName()` The name of the font.
    `int` | `getNumCharStrings()` Returns the number of charstrings in the font.
    `java.util.Map<java.lang.String,java.lang.Object>` | `getTopDict()` Returns the top dictionary.
    `abstract Type2CharString` | `getType2CharString(int cidOrGid)` Returns the Type 2 charstring for the given CID.
    `java.lang.String` | `toString()`

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

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

    - ### Methods inherited from interface org.apache.fontbox.FontBoxFont

      `getPath, getWidth, hasGlyph`

- - ### Field Detail

    - #### fontName

          protected java.lang.String fontName

    - #### topDict

          protected final java.util.Map<java.lang.String,java.lang.Object> topDict

    - #### charset

          protected CFFCharset charset

    - #### charStrings

          protected byte[][] charStrings

    - #### globalSubrIndex

          protected byte[][] globalSubrIndex

  - ### Constructor Detail

    - #### CFFFont

          public CFFFont()

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      The name of the font.
      Specified by:
        `getName` in interface `FontBoxFont`
      Returns:
        the name of the font

    - #### addValueToTopDict

          public void addValueToTopDict(java.lang.String name,
                               java.lang.Object value)

      Adds the given key/value pair to the top dictionary.
      Parameters:
        `name` - the given key
        `value` - the given value

    - #### getTopDict

          public java.util.Map<java.lang.String,java.lang.Object> getTopDict()

      Returns the top dictionary.
      Returns:
        the dictionary

    - #### getFontMatrix

          public abstract java.util.List<java.lang.Number> getFontMatrix()

      Returns the FontMatrix.
      Specified by:
        `getFontMatrix` in interface `FontBoxFont`

    - #### getFontBBox

          public BoundingBox getFontBBox()

      Returns the FontBBox.
      Specified by:
        `getFontBBox` in interface `FontBoxFont`

    - #### getCharset

          public CFFCharset getCharset()

      Returns the CFFCharset of the font.
      Returns:
        the charset

    - #### getCharStringBytes

          public final java.util.List<byte[]> getCharStringBytes()

      Returns the character strings dictionary. For expert users only.
      Returns:
        the dictionary

    - #### getData

          public byte[] getData()
                         throws java.io.IOException

      Returns the CFF data.
      Throws:
        `java.io.IOException`

    - #### getNumCharStrings

          public int getNumCharStrings()

      Returns the number of charstrings in the font.

    - #### getGlobalSubrIndex

          public java.util.List<byte[]> getGlobalSubrIndex()

      Returns the list containing the global subroutine .
      Returns:
        the dictionary

    - #### getType2CharString

          public abstract Type2CharString getType2CharString(int cidOrGid)
                                                      throws java.io.IOException

      Returns the Type 2 charstring for the given CID.
      Parameters:
        `cidOrGid` - CID for CIFFont, or GID for Type 1 font
      Throws:
        `java.io.IOException` - if the charstring could not be read

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`