/** * Creates a new empty table builder for the table type given by the table id tag. * * <p>This new table will be added to the font and will replace any existing builder for that * table. * * @param tag * @return new empty table of the type specified by tag; if tag is not known then a generic * OpenTypeTable is returned */ public Table.Builder<? extends Table> newTableBuilder(int tag) { Header header = new Header(tag); Table.Builder<? extends Table> builder = Table.Builder.getBuilder(header, null); this.tableBuilders.put(header.tag(), builder); return builder; }
/** * Creates a new table builder for the table type given by the table id tag. It makes a copy of * the data provided and uses that copy for the table. * * <p>This new table has been added to the font and will replace any existing builder for that * table. * * @param tag * @param srcData * @return new empty table of the type specified by tag; if tag is not known then a generic * OpenTypeTable is returned */ public Table.Builder<? extends Table> newTableBuilder(int tag, ReadableFontData srcData) { WritableFontData data; data = WritableFontData.createWritableFontData(srcData.length()); // TODO(stuartg): take over original data instead? srcData.copyTo(data); Header header = new Header(tag, data.length()); Table.Builder<? extends Table> builder = Table.Builder.getBuilder(header, data); this.tableBuilders.put(tag, builder); return builder; }
private Table.Builder<? extends Table> getTableBuilder(Header header, WritableFontData data) { Table.Builder<? extends Table> builder = Table.Builder.getBuilder(header, data); return builder; }