/** * 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 java.io.IOException the font file could not be read */ private Map<Integer, int[]> readFormat0() throws java.io.IOException { Map<Integer, int[]> h = new LinkedHashMap<>(); raf.skipBytes(4); for (int k = 0; k < 256; ++k) { int[] r = new int[2]; r[0] = raf.readUnsignedByte(); r[1] = getGlyphWidth(r[0]); h.put(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 java.io.IOException the font file could not be read */ private Map<Integer, int[]> readFormat0() throws java.io.IOException { Map<Integer, int[]> h = new LinkedHashMap<>(); raf.skipBytes(4); for (int k = 0; k < 256; ++k) { int[] r = new int[2]; r[0] = raf.readUnsignedByte(); r[1] = getGlyphWidth(r[0]); h.put(k, 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 java.io.IOException the font file could not be read */ private Map<Integer, int[]> readFormat6() throws java.io.IOException { Map<Integer, int[]> h = new LinkedHashMap<>(); raf.skipBytes(4); int start_code = raf.readUnsignedShort(); int code_count = raf.readUnsignedShort(); for (int k = 0; k < code_count; ++k) { int[] r = new int[2]; r[0] = raf.readUnsignedShort(); r[1] = getGlyphWidth(r[0]); h.put(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 java.io.IOException the font file could not be read */ private Map<Integer, int[]> readFormat6() throws java.io.IOException { Map<Integer, int[]> h = new LinkedHashMap<>(); raf.skipBytes(4); int start_code = raf.readUnsignedShort(); int code_count = raf.readUnsignedShort(); for (int k = 0; k < code_count; ++k) { int[] r = new int[2]; r[0] = raf.readUnsignedShort(); r[1] = getGlyphWidth(r[0]); h.put(k + start_code, r); } return h; }
private Map<Integer, int[]> readFormat12() throws java.io.IOException { Map<Integer, int[]> h = new LinkedHashMap<>(); raf.skipBytes(2); @SuppressWarnings("unused") int table_length = raf.readInt(); raf.skipBytes(4); int nGroups = raf.readInt(); for (int k = 0; k < nGroups; k++) { int startCharCode = raf.readInt(); int endCharCode = raf.readInt(); int startGlyphID = raf.readInt(); for (int i = startCharCode; i <= endCharCode; i++) { int[] r = new int[2]; r[0] = startGlyphID; r[1] = getGlyphWidth(r[0]); h.put(i, r); startGlyphID++; } } return h; } }
private Map<Integer, int[]> readFormat12() throws java.io.IOException { Map<Integer, int[]> h = new LinkedHashMap<>(); raf.skipBytes(2); @SuppressWarnings("unused") int table_length = raf.readInt(); raf.skipBytes(4); int nGroups = raf.readInt(); for (int k = 0; k < nGroups; k++) { int startCharCode = raf.readInt(); int endCharCode = raf.readInt(); int startGlyphID = raf.readInt(); for (int i = startCharCode; i <= endCharCode; i++) { int[] r = new int[2]; r[0] = startGlyphID; r[1] = getGlyphWidth(r[0]); h.put(i, r); startGlyphID++; } } return h; } }
r[1] = getGlyphWidth(r[0]);
r[1] = getGlyphWidth(r[0]);