TTFSubsetter subsetter = new TTFSubsetter(ttf, tables); subsetter.addAll(subsetCodePoints); subsetter.addGlyphIds(allGlyphIds); Map<Integer, Integer> gidToCid = subsetter.getGIDMap(); String tag = getTag(gidToCid); subsetter.setPrefix(tag); subsetter.writeToStream(out);
/** * Add the given character codes to the subset. * * @param unicodeSet character code set */ public void addAll(Set<Integer> unicodeSet) { for (int unicode : unicodeSet) { add(unicode); } }
addCompoundReferences(); byte[] head = buildHeadTable(); byte[] hhea = buildHheaTable(); byte[] maxp = buildMaxpTable(); byte[] name = buildNameTable(); byte[] os2 = buildOS2Table(); byte[] glyf = buildGlyfTable(newLoca); byte[] loca = buildLocaTable(newLoca); byte[] cmap = buildCmapTable(); byte[] hmtx = buildHmtxTable(); byte[] post = buildPostTable(); long checksum = writeFileHeader(out, tables.size()); long offset = 12L + 16L * tables.size(); for (Map.Entry<String, byte[]> entry : tables.entrySet()) checksum += writeTableHeader(out, entry.getKey(), offset, entry.getValue()); offset += (entry.getValue().length + 3) / 4 * 4; for (byte[] bytes : tables.values()) writeTableBody(out, bytes);
/** * Returns the map of new -> old GIDs. */ public Map<Integer, Integer> getGIDMap() throws IOException { addCompoundReferences(); Map<Integer, Integer> newToOld = new HashMap<>(); int newGID = 0; for (int oldGID : glyphIds) { newToOld.put(newGID, oldGID); newGID++; } return newToOld; }
/** * Returns the map of new -> old GIDs. */ public Map<Integer, Integer> getGIDMap() throws IOException { addCompoundReferences(); Map<Integer, Integer> newToOld = new HashMap<Integer, Integer>(); int newGID = 0; for (int oldGID : glyphIds) { newToOld.put(newGID, oldGID); newGID++; } return newToOld; }
addCompoundReferences(); byte[] head = buildHeadTable(); byte[] hhea = buildHheaTable(); byte[] maxp = buildMaxpTable(); byte[] name = buildNameTable(); byte[] os2 = buildOS2Table(); byte[] glyf = buildGlyfTable(newLoca); byte[] loca = buildLocaTable(newLoca); byte[] cmap = buildCmapTable(); byte[] hmtx = buildHmtxTable(); byte[] post = buildPostTable(); long checksum = writeFileHeader(out, tables.size()); long offset = 12L + 16L * tables.size(); for (Map.Entry<String, byte[]> entry : tables.entrySet()) checksum += writeTableHeader(out, entry.getKey(), offset, entry.getValue()); offset += (entry.getValue().length + 3) / 4 * 4; for (byte[] bytes : tables.values()) writeTableBody(out, bytes);
TTFSubsetter subsetter = new TTFSubsetter(ttf, tables); subsetter.addAll(subsetCodePoints); Map<Integer, Integer> gidToCid = subsetter.getGIDMap(); String tag = getTag(gidToCid); subsetter.setPrefix(tag); subsetter.writeToStream(out);
/** * Add the given character codes to the subset. * * @param unicodeSet character code set */ public void addAll(Set<Integer> unicodeSet) { for (int unicode : unicodeSet) { add(unicode); } }
/** * Returns the map of new -> old GIDs. */ public Map<Integer, Integer> getGIDMap() throws IOException { addCompoundReferences(); Map<Integer, Integer> newToOld = new HashMap<>(); int newGID = 0; for (int oldGID : glyphIds) { newToOld.put(newGID, oldGID); newGID++; } return newToOld; }
addCompoundReferences(); byte[] head = buildHeadTable(); byte[] hhea = buildHheaTable(); byte[] maxp = buildMaxpTable(); byte[] name = buildNameTable(); byte[] os2 = buildOS2Table(); byte[] glyf = buildGlyfTable(newLoca); byte[] loca = buildLocaTable(newLoca); byte[] cmap = buildCmapTable(); byte[] hmtx = buildHmtxTable(); byte[] post = buildPostTable(); long checksum = writeFileHeader(out, tables.size()); long offset = 12L + 16L * tables.size(); for (Map.Entry<String, byte[]> entry : tables.entrySet()) checksum += writeTableHeader(out, entry.getKey(), offset, entry.getValue()); offset += (entry.getValue().length + 3) / 4 * 4; for (byte[] bytes : tables.values()) writeTableBody(out, bytes);
TTFSubsetter subsetter = new TTFSubsetter(ttf, tables); subsetter.addAll(subsetCodePoints); Map<Integer, Integer> gidToCid = subsetter.getGIDMap(); String tag = getTag(gidToCid); subsetter.setPrefix(tag); subsetter.writeToStream(out);
/** * Add the given character codes to the subset. * * @param unicodeSet character code set */ public void addAll(Set<Integer> unicodeSet) { for (int unicode : unicodeSet) { add(unicode); } }