public static String[] readFontNames(final FontData fontData,final int mode){
  final FontFile2 currentFontFile=new FontFile2(fontData);
  final int fontCount=currentFontFile.getFontCount();
  final String[] fontNames=new String[fontCount];
  for (int i=0; i < fontCount; i++) {
    currentFontFile.setSelectedFontIndex(i);
    final Name currentName=new Name(currentFontFile);
    final String name;
switch (mode) {
case PdfDecoderInt.SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME:
      name=currentName.getString(Name.POSTSCRIPT_NAME);
    break;
case PdfDecoderInt.SUBSTITUTE_FONT_USING_FAMILY_NAME:
  name=currentName.getString(Name.FONT_FAMILY_NAME);
break;
case PdfDecoderInt.SUBSTITUTE_FONT_USING_FULL_FONT_NAME:
name=currentName.getString(Name.FULL_FONT_NAME);
break;
default :
throw new RuntimeException("Unsupported mode " + mode + ". Unable to resolve font names");
}
if (name == null) {
fontNames[i]=null;
}
 else {
fontNames[i]=name.toLowerCase();
}
}
if (fontData != null) {
fontData.close();
}
return fontNames;
}

public static String [ ] readFontNames ( final FontData fontData , final int mode ) { final FontFile2 currentFontFile = new FontFile2 ( fontData ) ; final int fontCount = currentFontFile . getFontCount ( ) ; final String [ ] fontNames = new String [ fontCount ] ; for ( int i = 0 ; i < fontCount ; i ++ ) { currentFontFile . setSelectedFontIndex ( i ) ; final Name currentName = new Name ( currentFontFile ) ; final String name ; switch ( mode ) { case PdfDecoderInt . SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME : name = currentName . getString ( Name . POSTSCRIPT_NAME ) ; break ; case PdfDecoderInt . SUBSTITUTE_FONT_USING_FAMILY_NAME : name = currentName . getString ( Name . FONT_FAMILY_NAME ) ; break ; case PdfDecoderInt . SUBSTITUTE_FONT_USING_FULL_FONT_NAME : name = currentName . getString ( Name . FULL_FONT_NAME ) ; break ; default : throw new RuntimeException ( "Unsupported mode " + mode + ". Unable to resolve font names" ) ; } if ( name == null ) { fontNames [ i ] = null ; } else { fontNames [ i ] = name . toLowerCase ( ) ; } } if ( fontData != null ) { fontData . close ( ) ; } return fontNames ; }
return name of font or all fonts if ttc name will be lowercase to avoid issues of capitalisation when used for lookup - if no name , will default to null mode is pdfdecoder . substitute_ * constant . runtimeexception will be thrown on invalid value
