private CFFDataInput createTaggedCFFDataInput(CFFDataInput input, byte[] bytes) throws IOException { // this is OpenType font containing CFF data // so find CFF tag short numTables = input.readShort(); @SuppressWarnings({"unused", "squid:S1854"}) short searchRange = input.readShort(); @SuppressWarnings({"unused", "squid:S1854"}) short entrySelector = input.readShort(); @SuppressWarnings({"unused", "squid:S1854"}) short rangeShift = input.readShort(); for (int q = 0; q < numTables; q++) { String tagName = readTagName(input); @SuppressWarnings("unused") long checksum = readLong(input); long offset = readLong(input); long length = readLong(input); if ("CFF ".equals(tagName)) { byte[] bytes2 = Arrays.copyOfRange(bytes, (int) offset, (int) (offset + length)); return new CFFDataInput(bytes2); } } throw new IOException("CFF tag not found in this OpenType font."); }
CFFDataInput input = new CFFDataInput(bytes);
CFFDataInput fontDictInput = new CFFDataInput(bytes); DictData fontDict = readDictData(fontDictInput);
private CFFFont parseFont(CFFDataInput input, String name, byte[] topDictIndex) throws IOException CFFDataInput topDictInput = new CFFDataInput(topDictIndex); DictData topDict = readDictData(topDictInput);
/** * Constructor for the CFF data reader which accepts the CFF byte data * as an argument. * @param cffDataArray A byte array which holds the CFF data */ public CFFDataReader(byte[] cffDataArray) throws IOException { cffData = new CFFDataInput(cffDataArray); readCFFData(); }
/** * Constructor for the CFF data reader which accepts a FontFileReader object * which points to the original font file as an argument. * @param fontFile The font file as represented by a FontFileReader object */ public CFFDataReader(FontFileReader fontFile) throws IOException { cffData = new CFFDataInput(OTFFile.getCFFData(fontFile)); readCFFData(); }
byte[] localSubrData = font.getLocalSubrData().getByteData(); if (localSubrData != null) { return new CFFDataInput(localSubrData); } else { return null; byte[] localSubrsData = font.getLocalSubrData().getByteData(); if (localSubrsData != null) { return new CFFDataInput(localSubrsData); } else { return null;
private CFFDataInput createTaggedCFFDataInput(CFFDataInput input, byte[] bytes) throws IOException { // this is OpenType font containing CFF data // so find CFF tag short numTables = input.readShort(); @SuppressWarnings("unused") short searchRange = input.readShort(); @SuppressWarnings("unused") short entrySelector = input.readShort(); @SuppressWarnings("unused") short rangeShift = input.readShort(); for (int q = 0; q < numTables; q++) { String tagName = readTagName(input); @SuppressWarnings("unused") long checksum = readLong(input); long offset = readLong(input); long length = readLong(input); if ("CFF ".equals(tagName)) { byte[] bytes2 = Arrays.copyOfRange(bytes, (int) offset, (int) (offset + length)); return new CFFDataInput(bytes2); } } throw new IOException("CFF tag not found in this OpenType font."); }
CFFDataInput input = new CFFDataInput(bytes);
private CFFDataInput createTaggedCFFDataInput(CFFDataInput input, byte[] bytes) throws IOException { // this is OpenType font containing CFF data // so find CFF tag short numTables = input.readShort(); @SuppressWarnings("unused") short searchRange = input.readShort(); @SuppressWarnings("unused") short entrySelector = input.readShort(); @SuppressWarnings("unused") short rangeShift = input.readShort(); for (int q = 0; q < numTables; q++) { String tagName = readTagName(input); @SuppressWarnings("unused") long checksum = readLong(input); long offset = readLong(input); long length = readLong(input); if ("CFF ".equals(tagName)) { byte[] bytes2 = Arrays.copyOfRange(bytes, (int) offset, (int) (offset + length)); return new CFFDataInput(bytes2); } } throw new IOException("CFF tag not found in this OpenType font."); }
CFFDataInput input = new CFFDataInput(bytes);
CFFDataInput fontDictInput = new CFFDataInput(bytes); DictData fontDict = readDictData(fontDictInput);
CFFDataInput fontDictInput = new CFFDataInput(bytes); DictData fontDict = readDictData(fontDictInput);
/** * Reads the CFFData from a given font file * @param fontFile The font file being read * @return The byte data found in the CFF table */ public static byte[] getCFFData(FontFileReader fontFile) throws IOException { byte[] cff = fontFile.getAllBytes(); CFFDataInput input = new CFFDataInput(fontFile.getAllBytes()); input.readBytes(4); //OTTO short numTables = input.readShort(); input.readShort(); //searchRange input.readShort(); //entrySelector input.readShort(); //rangeShift for (int q = 0; q < numTables; q++) { String tagName = new String(input.readBytes(4)); readLong(input); //Checksum long offset = readLong(input); long length = readLong(input); if (tagName.equals("CFF ")) { cff = new byte[(int)length]; System.arraycopy(fontFile.getAllBytes(), (int)offset, cff, 0, cff.length); break; } } return cff; }
private CFFFont parseFont(CFFDataInput input, String name, byte[] topDictIndex) throws IOException CFFDataInput topDictInput = new CFFDataInput(topDictIndex); DictData topDict = readDictData(topDictInput);
private CFFFont parseFont(CFFDataInput input, String name, byte[] topDictIndex) throws IOException CFFDataInput topDictInput = new CFFDataInput(topDictIndex); DictData topDict = readDictData(topDictInput);