Class CFFFont

java.lang.Object
com.itextpdf.io.font.CFFFont
Direct Known Subclasses:
CFFFontSubset

public class CFFFont extends Object
Class containing base Compact Font Format functionality
  • Field Details

    • key

      protected String key
    • args

      protected Object[] args
    • arg_count

      protected int arg_count
    • buf

      protected RandomAccessFileOrArray buf
      A random Access File or an array
    • nameIndexOffset

      protected int nameIndexOffset
    • topdictIndexOffset

      protected int topdictIndexOffset
    • stringIndexOffset

      protected int stringIndexOffset
    • gsubrIndexOffset

      protected int gsubrIndexOffset
    • nameOffsets

      protected int[] nameOffsets
    • topdictOffsets

      protected int[] topdictOffsets
    • stringOffsets

      protected int[] stringOffsets
    • gsubrOffsets

      protected int[] gsubrOffsets
    • fonts

      protected CFFFont.Font[] fonts
  • Constructor Details

    • CFFFont

      public CFFFont (byte[] cff)
      Creates a new CFF font instance from CFF font data.
      Parameters:
      cff - cff font binary data
  • Method Details

    • getString

      public String getString (char sid)
      Gets string from INDEX structure which corresponds to provided SID.
      Parameters:
      sid - 2-byte string identifier
      Returns:
      string value
    • getDictItem

      protected void getDictItem()
    • getEntireIndexRange

      protected CFFFont.RangeItem getEntireIndexRange (int indexOffset)
      A utility that creates a range item for an entire index
      Parameters:
      indexOffset - where the index is
      Returns:
      a range item representing the entire index
    • getCID

      public byte[] getCID (String fontName)
      Gets a single CID font. The PDF architecture (1.4) supports 16-bit strings only with CID CFF fonts, not in Type-1 CFF fonts, so we convert the font to CID if it is in the Type-1 format. Two other tasks that we need to do are to select only a single font from the CFF package (this again is a PDF restriction) and to subset the CharStrings glyph description.
      Parameters:
      fontName - name of the font
      Returns:
      byte array represents the CID font
    • isCID

      public boolean isCID()
      Determines whether the first font in FontSet is CID font.
      Returns:
      true if font is CID, false otherwise
    • isCID

      public boolean isCID (String fontName)
      Determines whether specified font is CID font.
      Parameters:
      fontName - font name to check in fonts table
      Returns:
      true if specified font is CID, false otherwise
    • exists

      public boolean exists (String fontName)
      Checks for font existence in FontSet.
      Parameters:
      fontName - font name to search for
      Returns:
      true if font exists in FontSet, false otherwise
    • getNames

      public String[] getNames()
      Gets all font names from FontSet table.
      Returns:
      font names contained by this CFF font