private static DictData readDictData(CFFDataInput input, int dictSize) throws IOException { DictData dict = new DictData(); int endPosition = input.getPosition() + dictSize; while (input.getPosition() < endPosition) { dict.add(readEntry(input)); } return dict; }
/** * Reads an index from the current position of the CFFDataInput object * @param input The object holding the CFF byte data * @return Returns an object representing the index * @throws IOException Throws an IO Exception if an error occurs */ public CFFIndexData readIndex(CFFDataInput input) throws IOException { CFFIndexData nameIndex = new CFFIndexData(); if (input != null) { int origPos = input.getPosition(); nameIndex.parseIndexHeader(input); int tableSize = input.getPosition() - origPos; nameIndex.setByteData(input.getPosition() - tableSize, tableSize); } return nameIndex; }
private static DictData readDictData(CFFDataInput input, int dictSize) throws IOException { DictData dict = new DictData(); int endPosition = input.getPosition() + dictSize; while (input.getPosition() < endPosition) { dict.add(readEntry(input)); } return dict; }
private static DictData readDictData(CFFDataInput input, int dictSize) throws IOException { DictData dict = new DictData(); int endPosition = input.getPosition() + dictSize; while (input.getPosition() < endPosition) { dict.add(readEntry(input)); } return dict; }
/** * Retrieves data from the index data * @param index The index position of the data to retrieve * @return Returns the byte data for the given index * @throws IOException Throws an IO Exception if an error occurs */ public byte[] getValue(int index) throws IOException { int oldPos = cffData.getPosition(); try { cffData.setPosition(dataLocation.getDataPosition() + (offsets[index] - 1)); return cffData.readBytes(offsets[index + 1] - offsets[index]); } finally { cffData.setPosition(oldPos); } }
public byte[] getPrivateDictData() throws IOException { int origPos = cffData.getPosition(); try { cffData.setPosition(dataLocation.getDataPosition()); return cffData.readBytes(dataLocation.getDataLength()); } finally { cffData.setPosition(origPos); } }
public byte[] getByteData() throws IOException { int oldPos = cffData.getPosition(); try { cffData.setPosition(dataLocation.getDataPosition()); return cffData.readBytes(dataLocation.getDataLength()); } finally { cffData.setPosition(oldPos); } } }
public byte[] getData() throws IOException { int origPos = cffData.getPosition(); try { cffData.setPosition(dataLocation.getDataPosition()); return cffData.readBytes(dataLocation.getDataLength()); } finally { cffData.setPosition(origPos); } }
/** * Retrieves the SID for the given GID object * @param charsetOffset The offset of the charset data * @param gid The GID for which to retrieve the SID * @return Returns the SID as an integer */ public int getSIDFromGID(int charsetOffset, int gid) throws IOException { if (gid == 0) { return 0; } cffData.setPosition(charsetOffset); int charsetFormat = cffData.readCard8(); switch (charsetFormat) { case 0: //Adjust for .notdef character cffData.setPosition(cffData.getPosition() + (--gid * 2)); return cffData.readSID(); case 1: return getSIDFromGIDFormat(gid, 1); case 2: return getSIDFromGIDFormat(gid, 2); default: return 0; } }
int position = cffData.getPosition(); int dataSize = offsets[offsets.length - 1] - offsets[0]; cffData.setPosition(cffData.getPosition() + dataSize); setData(position, dataSize);