public static DataDisplayTable listScriptCoverage(Font font){
  String[] header={"Script","Coverage"};
  Align[] displayAlignment={Align.Left,Align.Right};
  DataDisplayTable table=new DataDisplayTable(Arrays.asList(header));
  table.setAlignment(Arrays.asList(displayAlignment));
  HashMap<Integer,Integer> coveredScripts=new HashMap<Integer,Integer>();
  CMap cmap=FontUtils.getUCSCMap(font);
  for (  int charId : cmap) {
    if (cmap.glyphId(charId) != CMapTable.NOTDEF) {
      int scriptCode=UScript.getScript(charId);
      int scriptCount=1;
      if (coveredScripts.containsKey(scriptCode)) {
        scriptCount+=coveredScripts.get(scriptCode);
      }
      coveredScripts.put(scriptCode,scriptCount);
    }
  }
  Set<Integer> sortedScripts=new TreeSet<Integer>(coveredScripts.keySet());
  int unknown=0;
  for (  Integer scriptCode : sortedScripts) {
    UnicodeSet scriptSet=null;
    String scriptName=UScript.getName(scriptCode);
    try {
      scriptSet=new UnicodeSet("[[:" + scriptName + ":]]");
    }
 catch (    IllegalIcuArgumentException e) {
      unknown+=coveredScripts.get(scriptCode);
      continue;
    }
    table.add(Arrays.asList(new String[]{scriptName,String.format("%d / %d",coveredScripts.get(scriptCode),scriptSet.size())}));
  }
  if (unknown > 0) {
    table.add(Arrays.asList(new String[]{"Unsupported script",String.format("%d",unknown)}));
  }
  return table;
}

public static DataDisplayTable listScriptCoverage ( Font font ) { String [ ] header = { "Script" , "Coverage" } ; Align [ ] displayAlignment = { Align . Left , Align . Right } ; DataDisplayTable table = new DataDisplayTable ( Arrays . asList ( header ) ) ; table . setAlignment ( Arrays . asList ( displayAlignment ) ) ; HashMap < Integer , Integer > coveredScripts = new HashMap < Integer , Integer > ( ) ; CMap cmap = FontUtils . getUCSCMap ( font ) ; for ( int charId : cmap ) { if ( cmap . glyphId ( charId ) != CMapTable . NOTDEF ) { int scriptCode = UScript . getScript ( charId ) ; int scriptCount = 1 ; if ( coveredScripts . containsKey ( scriptCode ) ) { scriptCount += coveredScripts . get ( scriptCode ) ; } coveredScripts . put ( scriptCode , scriptCount ) ; } } Set < Integer > sortedScripts = new TreeSet < Integer > ( coveredScripts . keySet ( ) ) ; int unknown = 0 ; for ( Integer scriptCode : sortedScripts ) { UnicodeSet scriptSet = null ; String scriptName = UScript . getName ( scriptCode ) ; try { scriptSet = new UnicodeSet ( "[[:" + scriptName + ":]]" ) ; } catch ( IllegalIcuArgumentException e ) { unknown += coveredScripts . get ( scriptCode ) ; continue ; } table . add ( Arrays . asList ( new String [ ] { scriptName , String . format ( "%d / %d" , coveredScripts . get ( scriptCode ) , scriptSet . size ( ) ) } ) ) ; } if ( unknown > 0 ) { table . add ( Arrays . asList ( new String [ ] { "Unsupported script" , String . format ( "%d" , unknown ) } ) ) ; } return table ; }
gets a list of scripts covered by the font and the amount each block is covered .
