CFFDataReader (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.fonts.cff

## Class CFFDataReader

- java.lang.Object
- - org.apache.fop.fonts.cff.CFFDataReader

-     public class CFFDataReader
      extends Object

  A class to read the CFF data from an OTF CFF font file.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `CFFDataReader.CFFIndexData` An object used to hold index data from the CFF data
    `class` | `CFFDataReader.CFFSubTable` Parent class which provides the ability to retrieve byte data from a sub-table.
    `class` | `CFFDataReader.CustomEncoding`
    `static class` | `CFFDataReader.DICTEntry` A class containing data for a dictionary entry
    `class` | `CFFDataReader.FDSelect`
    `class` | `CFFDataReader.FontDict`
    `class` | `CFFDataReader.Format0Encoding`
    `class` | `CFFDataReader.Format0FDSelect`
    `class` | `CFFDataReader.Format1Encoding`
    `class` | `CFFDataReader.Format3FDSelect`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CFFDataReader()`
    `CFFDataReader(byte[] cffDataArray)` Constructor for the CFF data reader which accepts the CFF byte data as an argument.
    `CFFDataReader(FontFileReader fontFile)` Constructor for the CFF data reader which accepts a FontFileReader object which points to the original font file as an argument.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.fontbox.cff.DataInputByteArray` | `getCFFData()`
    `CFFDataReader.CFFIndexData` | `getCharStringIndex()`
    `CFFDataReader.CustomEncoding` | `getEncoding()`
    `List<CFFDataReader.FontDict>` | `getFDFonts()`
    `CFFDataReader.FDSelect` | `getFDSelect()`
    `CFFDataReader.CFFIndexData` | `getGlobalIndexSubr()`
    `byte[]` | `getHeader()`
    `CFFDataReader.CFFIndexData` | `getLocalIndexSubr()`
    `org.apache.fontbox.cff.DataInputByteArray` | `getLocalSubrsForGlyph(int glyph)`
    `CFFDataReader.CFFIndexData` | `getNameIndex()`
    `Map<String,CFFDataReader.DICTEntry>` | `getPrivateDict(CFFDataReader.DICTEntry privateEntry)`
    `byte[]` | `getPrivateDictBytes(CFFDataReader.DICTEntry privateEntry)`
    `int` | `getSIDFromGID(int charsetOffset, int gid)` Retrieves the SID for the given GID object
    `CFFDataReader.CFFIndexData` | `getStringIndex()`
    `LinkedHashMap<String,CFFDataReader.DICTEntry>` | `getTopDictEntries()`
    `CFFDataReader.CFFIndexData` | `getTopDictIndex()`
    `LinkedHashMap<String,CFFDataReader.DICTEntry>` | `parseDictData(byte[] dictData)` Parses the dictionary data and returns a map of objects for each entry
    `CFFDataReader.CFFIndexData` | `readCharStringIndex()` Parses the char string index from the CFF byte data
    `CFFDataReader.CFFIndexData` | `readIndex(org.apache.fontbox.cff.DataInputByteArray input)` Reads an index from the current position of the CFFDataInput object
    `CFFDataReader.CFFIndexData` | `readIndex(int offset)` Reads a CFF index object are the specified offset position

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

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

- - ### Constructor Detail

    - #### CFFDataReader

          public CFFDataReader()

    - #### CFFDataReader

          public CFFDataReader(byte[] cffDataArray)
                        throws IOException

      Constructor for the CFF data reader which accepts the CFF byte data as an argument.
      Parameters:
        `cffDataArray` - A byte array which holds the CFF data
      Throws:
        `IOException`

    - #### CFFDataReader

          public CFFDataReader(FontFileReader fontFile)
                        throws IOException

      Constructor for the CFF data reader which accepts a FontFileReader object which points to the original font file as an argument.
      Parameters:
        `fontFile` - The font file as represented by a FontFileReader object
      Throws:
        `IOException`

  - ### Method Detail

    - #### getPrivateDict

          public Map<String,CFFDataReader.DICTEntry> getPrivateDict(CFFDataReader.DICTEntry privateEntry)
                                                             throws IOException

      Throws:
        `IOException`

    - #### getPrivateDictBytes

          public byte[] getPrivateDictBytes(CFFDataReader.DICTEntry privateEntry)
                                     throws IOException

      Throws:
        `IOException`

    - #### parseDictData

          public LinkedHashMap<String,CFFDataReader.DICTEntry> parseDictData(byte[] dictData)
                                                                      throws IOException

      Parses the dictionary data and returns a map of objects for each entry
      Parameters:
        `dictData` - The data for the dictionary data
      Returns:
        Returns a map of type DICTEntry identified by the operand name
      Throws:
        `IOException` - Throws an IO Exception if an error occurs

    - #### readIndex

          public CFFDataReader.CFFIndexData readIndex(int offset)
                                               throws IOException

      Reads a CFF index object are the specified offset position
      Parameters:
        `offset` - The position of the index object to read
      Returns:
        Returns an object representing the index
      Throws:
        `IOException` - Throws an IO Exception if an error occurs

    - #### readIndex

          public CFFDataReader.CFFIndexData readIndex(org.apache.fontbox.cff.DataInputByteArray input)
                                               throws IOException

      Reads an index from the current position of the CFFDataInput object
      Parameters:
        `input` - The object holding the CFF byte data
      Returns:
        Returns an object representing the index
      Throws:
        `IOException` - Throws an IO Exception if an error occurs

    - #### getSIDFromGID

          public int getSIDFromGID(int charsetOffset,
                                   int gid)
                            throws IOException

      Retrieves the SID for the given GID object
      Parameters:
        `charsetOffset` - The offset of the charset data
        `gid` - The GID for which to retrieve the SID
      Returns:
        Returns the SID as an integer
      Throws:
        `IOException`

    - #### getHeader

          public byte[] getHeader()

    - #### getNameIndex

          public CFFDataReader.CFFIndexData getNameIndex()

    - #### getTopDictIndex

          public CFFDataReader.CFFIndexData getTopDictIndex()

    - #### getTopDictEntries

          public LinkedHashMap<String,CFFDataReader.DICTEntry> getTopDictEntries()

    - #### getStringIndex

          public CFFDataReader.CFFIndexData getStringIndex()

    - #### getGlobalIndexSubr

          public CFFDataReader.CFFIndexData getGlobalIndexSubr()

    - #### getLocalIndexSubr

          public CFFDataReader.CFFIndexData getLocalIndexSubr()

    - #### getCharStringIndex

          public CFFDataReader.CFFIndexData getCharStringIndex()

    - #### getCFFData

          public org.apache.fontbox.cff.DataInputByteArray getCFFData()

    - #### getEncoding

          public CFFDataReader.CustomEncoding getEncoding()

    - #### getFDSelect

          public CFFDataReader.FDSelect getFDSelect()

    - #### getFDFonts

          public List<CFFDataReader.FontDict> getFDFonts()

    - #### getLocalSubrsForGlyph

          public org.apache.fontbox.cff.DataInputByteArray getLocalSubrsForGlyph(int glyph)
                                                                          throws IOException

      Throws:
        `IOException`

    - #### readCharStringIndex

          public CFFDataReader.CFFIndexData readCharStringIndex()
                                                         throws IOException

      Parses the char string index from the CFF byte data
      Returns:
        Returns the char string index object
      Throws:
        `IOException` - Throws an IO Exception if an error occurs

Copyright © 2025 Apache Software Foundation. All rights reserved.