public static DataDisplayTable listTables(Font font){
  String[] header={"tag","checksum","length","offset"};
  Align[] displayAlignment={Align.Left,Align.Right,Align.Right,Align.Right};
  DataDisplayTable table=new DataDisplayTable(Arrays.asList(header));
  table.setAlignment(Arrays.asList(displayAlignment));
  int fontSize=0;
  Iterator<? extends Table> fontTableIter=font.iterator();
  while (fontTableIter.hasNext()) {
    Table fontTable=fontTableIter.next();
    fontSize+=fontTable.headerLength();
  }
  fontTableIter=font.iterator();
  while (fontTableIter.hasNext()) {
    Table fontTable=fontTableIter.next();
    String name=Tag.stringValue(fontTable.headerTag());
    String checksum=String.format("0x%0" + CHECKSUM_LENGTH + "X",fontTable.headerChecksum());
    int length=fontTable.headerLength();
    double lengthPercent=length * 100.0 / fontSize;
    int offset=fontTable.headerOffset();
    String[] data={name,checksum,String.format("%s (%s%%)",length,twoDecimalPlaces.format(lengthPercent)),String.format("%d",offset)};
    table.add(Arrays.asList(data));
  }
  return table;
}

public static DataDisplayTable listTables ( Font font ) { String [ ] header = { "tag" , "checksum" , "length" , "offset" } ; Align [ ] displayAlignment = { Align . Left , Align . Right , Align . Right , Align . Right } ; DataDisplayTable table = new DataDisplayTable ( Arrays . asList ( header ) ) ; table . setAlignment ( Arrays . asList ( displayAlignment ) ) ; int fontSize = 0 ; Iterator < ? extends Table > fontTableIter = font . iterator ( ) ; while ( fontTableIter . hasNext ( ) ) { Table fontTable = fontTableIter . next ( ) ; fontSize += fontTable . headerLength ( ) ; } fontTableIter = font . iterator ( ) ; while ( fontTableIter . hasNext ( ) ) { Table fontTable = fontTableIter . next ( ) ; String name = Tag . stringValue ( fontTable . headerTag ( ) ) ; String checksum = String . format ( "0x%0" + CHECKSUM_LENGTH + "X" , fontTable . headerChecksum ( ) ) ; int length = fontTable . headerLength ( ) ; double lengthPercent = length * 100.0 / fontSize ; int offset = fontTable . headerOffset ( ) ; String [ ] data = { name , checksum , String . format ( "%s (%s%%)" , length , twoDecimalPlaces . format ( lengthPercent ) ) , String . format ( "%d" , offset ) } ; table . add ( Arrays . asList ( data ) ) ; } return table ; }
gets a list of tables in the font as well as their sizes . this function returns a list of tables in the given font as well as their sizes , both in bytes and as fractions of the overall font size . the information for each font is contained in a tableinfo object .
