/** * The information in the maps of the table 'cmap' is coded in several formats. * Format 0 is the Apple standard character to glyph index mapping table. * * @return a <CODE>HashMap</CODE> representing this map * @throws IOException the font file could not be read */ HashMap<Integer, int[]> readFormat0() throws IOException { HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); rf.skipBytes(4); for (int k = 0; k < 256; ++k) { int r[] = new int[2]; r[0] = rf.readUnsignedByte(); r[1] = getGlyphWidth(r[0]); h.put(Integer.valueOf(k), r); } return h; }
/** * The information in the maps of the table 'cmap' is coded in several formats. * Format 0 is the Apple standard character to glyph index mapping table. * * @return a <CODE>HashMap</CODE> representing this map * @throws IOException the font file could not be read */ HashMap<Integer, int[]> readFormat0() throws IOException { HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); rf.skipBytes(4); for (int k = 0; k < 256; ++k) { int r[] = new int[2]; r[0] = rf.readUnsignedByte(); r[1] = getGlyphWidth(r[0]); h.put(Integer.valueOf(k), r); } return h; }
HashMap<Integer, int[]> readFormat12() throws IOException { HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); rf.skipBytes(2); int table_lenght = rf.readInt(); rf.skipBytes(4); int nGroups = rf.readInt(); for (int k = 0; k < nGroups; k++) { int startCharCode = rf.readInt(); int endCharCode = rf.readInt(); int startGlyphID = rf.readInt(); for (int i = startCharCode; i <= endCharCode; i++) { int[] r = new int[2]; r[0] = startGlyphID; r[1] = getGlyphWidth(r[0]); h.put(Integer.valueOf(i), r); startGlyphID++; } } return h; }
HashMap<Integer, int[]> readFormat12() throws IOException { HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); rf.skipBytes(2); int table_lenght = rf.readInt(); rf.skipBytes(4); int nGroups = rf.readInt(); for (int k = 0; k < nGroups; k++) { int startCharCode = rf.readInt(); int endCharCode = rf.readInt(); int startGlyphID = rf.readInt(); for (int i = startCharCode; i <= endCharCode; i++) { int[] r = new int[2]; r[0] = startGlyphID; r[1] = getGlyphWidth(r[0]); h.put(Integer.valueOf(i), r); startGlyphID++; } } return h; }
/** * The information in the maps of the table 'cmap' is coded in several formats. * Format 6 is a trimmed table mapping. It is similar to format 0 but can have * less than 256 entries. * * @return a <CODE>HashMap</CODE> representing this map * @throws IOException the font file could not be read */ HashMap<Integer, int[]> readFormat6() throws IOException { HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); rf.skipBytes(4); int start_code = rf.readUnsignedShort(); int code_count = rf.readUnsignedShort(); for (int k = 0; k < code_count; ++k) { int r[] = new int[2]; r[0] = rf.readUnsignedShort(); r[1] = getGlyphWidth(r[0]); h.put(Integer.valueOf(k + start_code), r); } return h; }
/** * The information in the maps of the table 'cmap' is coded in several formats. * Format 6 is a trimmed table mapping. It is similar to format 0 but can have * less than 256 entries. * * @return a <CODE>HashMap</CODE> representing this map * @throws IOException the font file could not be read */ HashMap<Integer, int[]> readFormat6() throws IOException { HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); rf.skipBytes(4); int start_code = rf.readUnsignedShort(); int code_count = rf.readUnsignedShort(); for (int k = 0; k < code_count; ++k) { int r[] = new int[2]; r[0] = rf.readUnsignedShort(); r[1] = getGlyphWidth(r[0]); h.put(Integer.valueOf(k + start_code), r); } return h; }
private void readLookupTable(int lookupTableLocation) throws IOException { rf.seek(lookupTableLocation); int lookupType = rf.readShort(); // LOG.debug("lookupType=" + lookupType); // skip 2 bytes for the field `lookupFlag` rf.skipBytes(2); int subTableCount = rf.readShort(); // LOG.debug("subTableCount=" + subTableCount); List<Integer> subTableOffsets = new ArrayList<Integer>(); for (int i = 0; i < subTableCount; i++) { int subTableOffset = rf.readShort(); subTableOffsets.add(subTableOffset); } for (int subTableOffset : subTableOffsets) { // LOG.debug("subTableOffset=" + subTableOffset); readSubTable(lookupType, lookupTableLocation + subTableOffset); } }
private void readLookupTable(int lookupTableLocation) throws IOException { rf.seek(lookupTableLocation); int lookupType = rf.readShort(); // LOG.debug("lookupType=" + lookupType); // skip 2 bytes for the field `lookupFlag` rf.skipBytes(2); int subTableCount = rf.readShort(); // LOG.debug("subTableCount=" + subTableCount); List<Integer> subTableOffsets = new ArrayList<Integer>(); for (int i = 0; i < subTableCount; i++) { int subTableOffset = rf.readShort(); subTableOffsets.add(subTableOffset); } for (int subTableOffset : subTableOffsets) { // LOG.debug("subTableOffset=" + subTableOffset); readSubTable(lookupType, lookupTableLocation + subTableOffset); } }
HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); int table_lenght = rf.readUnsignedShort(); rf.skipBytes(2); int segCount = rf.readUnsignedShort() / 2; rf.skipBytes(6); int endCount[] = new int[segCount]; for (int k = 0; k < segCount; ++k) { endCount[k] = rf.readUnsignedShort(); rf.skipBytes(2); int startCount[] = new int[segCount]; for (int k = 0; k < segCount; ++k) {
HashMap<Integer, int[]> h = new HashMap<Integer, int[]>(); int table_lenght = rf.readUnsignedShort(); rf.skipBytes(2); int segCount = rf.readUnsignedShort() / 2; rf.skipBytes(6); int endCount[] = new int[segCount]; for (int k = 0; k < segCount; ++k) { endCount[k] = rf.readUnsignedShort(); rf.skipBytes(2); int startCount[] = new int[segCount]; for (int k = 0; k < segCount; ++k) {
if (!mainTag.equals("ttcf")) throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.valid.ttc.file", fileName)); rf.skipBytes(4); int dirCount = rf.readInt(); names = new String[dirCount]; tables.clear(); rf.seek(dirPos); rf.skipBytes(dirIdx * 4); directoryOffset = rf.readInt(); rf.seek(directoryOffset); throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.valid.ttf.file", fileName)); int num_tables = rf.readUnsignedShort(); rf.skipBytes(6); for (int k = 0; k < num_tables; ++k) { String tag = readStandardString(4); rf.skipBytes(4); int table_location[] = new int[2]; table_location[0] = rf.readInt();
if (!mainTag.equals("ttcf")) throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.valid.ttc.file", fileName)); rf.skipBytes(4); int dirCount = rf.readInt(); names = new String[dirCount]; tables.clear(); rf.seek(dirPos); rf.skipBytes(dirIdx * 4); directoryOffset = rf.readInt(); rf.seek(directoryOffset); throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.valid.ttf.file", fileName)); int num_tables = rf.readUnsignedShort(); rf.skipBytes(6); for (int k = 0; k < num_tables; ++k) { String tag = readStandardString(4); rf.skipBytes(4); int table_location[] = new int[2]; table_location[0] = rf.readInt();
protected void createTableDirectory() throws IOException, DocumentException { tableDirectory = new HashMap<String, int[]>(); rf.seek(directoryOffset); int id = rf.readInt(); if (id != 0x00010000) throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.true.type.file", fileName)); int num_tables = rf.readUnsignedShort(); rf.skipBytes(6); for (int k = 0; k < num_tables; ++k) { String tag = readStandardString(4); int tableLocation[] = new int[3]; tableLocation[TABLE_CHECKSUM] = rf.readInt(); tableLocation[TABLE_OFFSET] = rf.readInt(); tableLocation[TABLE_LENGTH] = rf.readInt(); tableDirectory.put(tag, tableLocation); } }
protected void createTableDirectory() throws IOException, DocumentException { tableDirectory = new HashMap<String, int[]>(); rf.seek(directoryOffset); int id = rf.readInt(); if (id != 0x00010000) throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.true.type.file", fileName)); int num_tables = rf.readUnsignedShort(); rf.skipBytes(6); for (int k = 0; k < num_tables; ++k) { String tag = readStandardString(4); int tableLocation[] = new int[3]; tableLocation[TABLE_CHECKSUM] = rf.readInt(); tableLocation[TABLE_OFFSET] = rf.readInt(); tableLocation[TABLE_LENGTH] = rf.readInt(); tableDirectory.put(tag, tableLocation); } }
if (!mainTag.equals("ttcf")) throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.valid.ttc.file", fileName)); rf.skipBytes(4); int dirCount = rf.readInt(); if (dirIdx >= dirCount) throw new DocumentException(MessageLocalization.getComposedMessage("the.font.index.for.1.must.be.between.0.and.2.it.was.3", fileName, String.valueOf(dirCount - 1), String.valueOf(dirIdx))); rf.skipBytes(dirIdx * 4); directoryOffset = rf.readInt(); throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.valid.ttf.or.otf.file", fileName)); int num_tables = rf.readUnsignedShort(); rf.skipBytes(6); for (int k = 0; k < num_tables; ++k) { String tag = readStandardString(4); rf.skipBytes(4); int table_location[] = new int[2]; table_location[0] = rf.readInt();
throw new DocumentException(MessageLocalization.getComposedMessage("table.1.does.not.exist.in.2", "cmap", fileName + style)); rf.seek(table_location[0]); rf.skipBytes(2); int num_tables = rf.readUnsignedShort(); fontSpecific = false;