当前位置: 首页>>代码示例>>Java>>正文


Java FontDataTable类代码示例

本文整理汇总了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();
}
 
开发者ID:jtanx,项目名称:sfntly-java-mod,代码行数:24,代码来源:OtTableTagger.java

示例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();
}
 
开发者ID:terro,项目名称:WCFont,代码行数:29,代码来源:Font.java

示例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();
}
 
开发者ID:jtanx,项目名称:sfntly-java-mod,代码行数:9,代码来源:OtTableTagger.java

示例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;
}
 
开发者ID:jtanx,项目名称:sfntly-java-mod,代码行数:12,代码来源:OtTableTagger.java

示例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;
}
 
开发者ID:witwall,项目名称:sfntly-java,代码行数:68,代码来源:TestFontUtils.java

示例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();
}
 
开发者ID:jtanx,项目名称:sfntly-java-mod,代码行数:7,代码来源:OtTableTagger.java

示例7: TagMethod

import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
private TagMethod(Class<? extends FontDataTable> clzz) {
  this.clzz = clzz;
}
 
开发者ID:jtanx,项目名称:sfntly-java-mod,代码行数:4,代码来源:OtTableTagger.java

示例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());
}
 
开发者ID:jtanx,项目名称:sfntly-java-mod,代码行数:5,代码来源:OtTableTagger.java

示例9: tag

import com.google.typography.font.sfntly.table.FontDataTable; //导入依赖的package包/类
protected abstract void tag(FontDataTable table); 
开发者ID:jtanx,项目名称:sfntly-java-mod,代码行数:2,代码来源:OtTableTagger.java


注:本文中的com.google.typography.font.sfntly.table.FontDataTable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。