Package org.docx4j.fonts.fop.fonts.cff
Class CFFDataReader
java.lang.Object
org.docx4j.fonts.fop.fonts.cff.CFFDataReader
public class CFFDataReader
extends java.lang.Object
A class to read the CFF data from an OTF CFF font file.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCFFDataReader.CFFIndexDataAn object used to hold index data from the CFF dataclassCFFDataReader.CFFSubTableParent class which provides the ability to retrieve byte data from a sub-table.classCFFDataReader.CustomEncodingstatic classCFFDataReader.DICTEntryA class containing data for a dictionary entryclassCFFDataReader.FDSelectclassCFFDataReader.FontDictclassCFFDataReader.Format0EncodingclassCFFDataReader.Format0FDSelectclassCFFDataReader.Format1EncodingclassCFFDataReader.Format3FDSelect -
Constructor Summary
Constructors Constructor 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
Modifier and Type Method Description org.apache.fontbox.cff.CFFDataInputgetCFFData()CFFDataReader.CFFIndexDatagetCharStringIndex()CFFDataReader.CustomEncodinggetEncoding()java.util.List<CFFDataReader.FontDict>getFDFonts()CFFDataReader.FDSelectgetFDSelect()CFFDataReader.CFFIndexDatagetGlobalIndexSubr()byte[]getHeader()CFFDataReader.CFFIndexDatagetLocalIndexSubr()org.apache.fontbox.cff.CFFDataInputgetLocalSubrsForGlyph(int glyph)CFFDataReader.CFFIndexDatagetNameIndex()java.util.Map<java.lang.String,CFFDataReader.DICTEntry>getPrivateDict(CFFDataReader.DICTEntry privateEntry)byte[]getPrivateDictBytes(CFFDataReader.DICTEntry privateEntry)intgetSIDFromGID(int charsetOffset, int gid)Retrieves the SID for the given GID objectCFFDataReader.CFFIndexDatagetStringIndex()java.util.LinkedHashMap<java.lang.String,CFFDataReader.DICTEntry>getTopDictEntries()CFFDataReader.CFFIndexDatagetTopDictIndex()java.util.LinkedHashMap<java.lang.String,CFFDataReader.DICTEntry>parseDictData(byte[] dictData)Parses the dictionary data and returns a map of objects for each entryCFFDataReader.CFFIndexDatareadCharStringIndex()Parses the char string index from the CFF byte dataCFFDataReader.CFFIndexDatareadIndex(int offset)Reads a CFF index object are the specified offset positionCFFDataReader.CFFIndexDatareadIndex(org.apache.fontbox.cff.CFFDataInput input)Reads an index from the current position of the CFFDataInput objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
CFFDataReader
public CFFDataReader() -
CFFDataReader
public CFFDataReader(byte[] cffDataArray) throws java.io.IOExceptionConstructor 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:
java.io.IOException
-
CFFDataReader
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:
java.io.IOException
-
-
Method Details
-
getPrivateDict
public java.util.Map<java.lang.String,CFFDataReader.DICTEntry> getPrivateDict(CFFDataReader.DICTEntry privateEntry) throws java.io.IOException- Throws:
java.io.IOException
-
getPrivateDictBytes
- Throws:
java.io.IOException
-
parseDictData
public java.util.LinkedHashMap<java.lang.String,CFFDataReader.DICTEntry> parseDictData(byte[] dictData) throws java.io.IOExceptionParses 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:
java.io.IOException- Throws an IO Exception if an error occurs
-
readIndex
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:
java.io.IOException- Throws an IO Exception if an error occurs
-
readIndex
public CFFDataReader.CFFIndexData readIndex(org.apache.fontbox.cff.CFFDataInput input) throws java.io.IOExceptionReads 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:
java.io.IOException- Throws an IO Exception if an error occurs
-
getSIDFromGID
public int getSIDFromGID(int charsetOffset, int gid) throws java.io.IOExceptionRetrieves the SID for the given GID object- Parameters:
charsetOffset- The offset of the charset datagid- The GID for which to retrieve the SID- Returns:
- Returns the SID as an integer
- Throws:
java.io.IOException
-
getHeader
public byte[] getHeader() -
getNameIndex
-
getTopDictIndex
-
getTopDictEntries
-
getStringIndex
-
getGlobalIndexSubr
-
getLocalIndexSubr
-
getCharStringIndex
-
getCFFData
public org.apache.fontbox.cff.CFFDataInput getCFFData() -
getEncoding
-
getFDSelect
-
getFDFonts
-
getLocalSubrsForGlyph
public org.apache.fontbox.cff.CFFDataInput getLocalSubrsForGlyph(int glyph) throws java.io.IOException- Throws:
java.io.IOException
-
readCharStringIndex
Parses the char string index from the CFF byte data- Returns:
- Returns the char string index object
- Throws:
java.io.IOException- Throws an IO Exception if an error occurs
-