Class CFFFont

java.lang.Object
org.apache.fontbox.cff.CFFFont
All Implemented Interfaces:
FontBoxFont
Direct Known Subclasses:
CFFCIDFont, CFFType1Font

public abstract class CFFFont extends Object implements FontBoxFont
An Adobe Compact Font Format (CFF) font. Thread safe.
  • Field Details

    • fontName

      protected String fontName
    • topDict

      protected final Map<String,Object> topDict
    • charset

      protected CFFCharset charset
    • charStrings

      protected byte[][] charStrings
    • globalSubrIndex

      protected byte[][] globalSubrIndex
    • source

      private CFFParser.ByteSource source
  • Constructor Details

    • CFFFont

      public CFFFont()
  • Method Details

    • getName

      public String getName()
      The name of the font.
      Specified by:
      getName in interface FontBoxFont
      Returns:
      the name of the font
    • setName

      void setName(String name)
      Sets the name of the font.
      Parameters:
      name - the name of the font
    • addValueToTopDict

      public void addValueToTopDict(String name, Object value)
      Adds the given key/value pair to the top dictionary.
      Parameters:
      name - the given key
      value - the given value
    • getTopDict

      public Map<String,Object> getTopDict()
      Returns the top dictionary.
      Returns:
      the dictionary
    • getFontMatrix

      public abstract List<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
    • setCharset

      void setCharset(CFFCharset charset)
      Sets the CFFCharset of the font.
      Parameters:
      charset - the given CFFCharset
    • getCharStringBytes

      public final List<byte[]> getCharStringBytes()
      Returns the character strings dictionary. For expert users only.
      Returns:
      the character strings dictionary as a list of byte arrays.
    • setData

      final void setData(CFFParser.ByteSource source)
      Sets a byte source to re-read the CFF data in the future.
    • getData

      public byte[] getData() throws IOException
      Returns the CFF data.
      Throws:
      IOException
    • getNumCharStrings

      public int getNumCharStrings()
      Returns the number of charstrings in the font.
    • setGlobalSubrIndex

      void setGlobalSubrIndex(byte[][] globalSubrIndexValue)
      Sets the global subroutine index data.
      Parameters:
      globalSubrIndexValue - a list of the global subroutines.
    • getGlobalSubrIndex

      public List<byte[]> getGlobalSubrIndex()
      Returns the list containing the global subroutines.
      Returns:
      a list of the global subroutines.
    • getType2CharString

      public abstract Type2CharString getType2CharString(int cidOrGid) throws IOException
      Returns the Type 2 charstring for the given CID.
      Parameters:
      cidOrGid - CID for CIFFont, or GID for Type 1 font
      Throws:
      IOException - if the charstring could not be read
    • toString

      public String toString()
      Overrides:
      toString in class Object