本文整理汇总了Java中com.google.typography.font.sfntly.table.FontDataTable类的典型用法代码示例。如果您正苦于以下问题:Java FontDataTable类的具体用法?Java FontDataTable怎么用?Java FontDataTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FontDataTable类属于com.google.typography.font.sfntly.table包,在下文中一共展示了FontDataTable类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tagTable
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
private void tagTable(FontDataTable table) {
if (table == null) {
return;
}
ReadableFontData data = table.readFontData();
if (data == null) {
return;
}
if (tableCache.contains(table.toString())) {
return;
}
tableCache.add(table.toString());
TagMethod tm = getTagMethod(table);
if (tm == null) {
td.pushRange(table.getClass().getSimpleName(), data);
} else {
td.pushRange(tm.tableLabel(table), data);
tm.tag(table);
}
td.popRange();
}
示例2: toString
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("digest = ");
byte[] digest = this.digest();
if (digest != null) {
for (int i = 0; i < digest.length; i++) {
int d = 0xff & digest[i];
if (d < 0x10) {
sb.append("0");
}
sb.append(Integer.toHexString(d));
}
}
sb.append("\n[");
sb.append(Fixed1616.toString(sfntVersion));
sb.append(", ");
sb.append(this.numTables());
sb.append("]\n");
Iterator<? extends Table> iter = this.iterator();
while (iter.hasNext()) {
FontDataTable table = iter.next();
sb.append("\t");
sb.append(table);
sb.append("\n");
}
return sb.toString();
}
示例3: tableLabel
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
private String tableLabel(FontDataTable table) {
Class<?> clzz = table.getClass();
Class<?> encl = clzz.getEnclosingClass();
if (encl == null) {
return clzz.getSimpleName();
}
return encl.getSimpleName() + "." + clzz.getSimpleName();
}
示例4: getTagMethod
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
private TagMethod getTagMethod(FontDataTable table) {
Class<? extends FontDataTable> clzz = table.getClass();
TagMethod tm = tagMethodRegistry.get(clzz);
if (tm == null) {
if (!missedClasses.contains(clzz)) {
missedClasses.add(clzz);
System.out.println("unregistered class: " + clzz.getName());
}
}
return tm;
}
示例5: buildAndCheckFont
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
public static
Font[] buildAndCheckFont(FontFactory fontFactory, InputStream is, int debug) throws IOException {
Font[] fontArray = fontFactory.loadFonts(is);
for (Font font : fontArray) {
if (debug >= 1) {
logger.info(font.toString());
}
FontHeaderTable head = font.getTable(Tag.head);
if (head != null) {
long magicNumber = head.magicNumber();
if (0x5F0F3CF5 != magicNumber) {
throw new RuntimeException("Magic number is incorrect.");
}
if (debug >= 2) {
logger.fine("magic number = " + Long.toHexString(magicNumber));
MaximumProfileTable maxp = font.getTable(Tag.maxp);
logger.fine("Number of glyphs = " + maxp.numGlyphs());
logger.fine("\n------ Tables by File Location");
}
} else {
// should find a bhed table if no head table
FontDataTable bhed = font.getTable(Tag.intValue("bhed"));
if (bhed == null) {
throw new RuntimeException("No head table or bhed");
}
}
Set<Table> tables = new TreeSet<Table>(TABLE_COMPARATOR_BY_OFFSET);
tables.addAll(font.tableMap().values());
for (Table table : tables) {
if (debug >= 2) {
System.out.println(table);
}
Header header = table.header();
boolean csValid = table.calculatedChecksum() == header.checksum();
if (!csValid) {
logger.severe("\t**** Checksum not valid!");
logger.severe("\tcalculated = 0x" + Long.toHexString(table.calculatedChecksum()));
logger.severe("\tread = 0x" + Long.toHexString(header.checksum()));
throw new RuntimeException("Checksum for table " + Tag.stringValue(header.tag()));
}
}
if (debug >= 2) {
logger.fine("\n------ CMap Tables");
CMapTable cmap = (CMapTable) font.getTable(Tag.cmap);
for (CMap cmt : cmap) {
logger.fine(cmt.toString());
for (int c = 0; c < 256; c++) {
logger.finer(c + " = " + cmt.glyphId(c));
}
}
logger.fine("\n----- Name Tables");
NameTable name = (NameTable) font.getTable(Tag.name);
for (NameEntry entry : name) {
logger.finer(entry.toString());
}
}
}
return fontArray;
}
示例6: OtTableTagger
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
OtTableTagger(TaggedData tdata) {
this.td = tdata;
this.tagMethodRegistry = new HashMap<Class<? extends FontDataTable>, TagMethod>();
registerTagMethods();
}
示例7: TagMethod
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
private TagMethod(Class<? extends FontDataTable> clzz) {
this.clzz = clzz;
}
示例8: compare
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
@Override
public int compare(Class<? extends FontDataTable> o1, Class<? extends FontDataTable> o2) {
return o1.getName().compareTo(o2.getName());
}
示例9: tag
import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
protected abstract void tag(FontDataTable table);