private final void readPostScript ( FontFileReader in ) throws IOException { seekTab ( in , "post" , 0 ) ; postFormat = in . readTTFLong ( ) ; italicAngle = in . readTTFULong ( ) ; underlinePosition = in . readTTFShort ( ) ; underlineThickness = in . readTTFShort ( ) ; isFixedPitch = in . readTTFULong ( ) ; //Skip memory usage values in . skip ( 4 * 4 ) ; log . debug ( "PostScript format: 0x" + Integer . toHexString ( postFormat ) ) ; switch ( postFormat ) { case 0x00010000 : log . debug ( "PostScript format 1" ) ; for ( int i = 0 ; i < Glyphs . MAC_GLYPH_NAMES . length ; i ++ ) { mtxTab [ i ] . setName ( Glyphs . MAC_GLYPH_NAMES [ i ] ) ; } break ; case 0x00020000 : log . debug ( "PostScript format 2" ) ; int numGlyphStrings = 0 ; // Read Number of Glyphs int l = in . readTTFUShort ( ) ; // Read indexes for ( int i = 0 ; i < l ; i ++ ) { mtxTab [ i ] . setIndex ( in . readTTFUShort ( ) ) ; if ( mtxTab [ i ] . getIndex ( ) > 257 ) { //Index is not in the Macintosh standard set numGlyphStrings ++ ; } if ( log . isTraceEnabled ( ) ) { log . trace ( "PostScript index: " + mtxTab [ i ] . getIndexAsString ( ) ) ; } } // firstChar=minIndex; String [ ] psGlyphsBuffer = new String [ numGlyphStrings ] ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Reading " + numGlyphStrings + " glyphnames, that are not in the standard Macintosh" + " set. Total number of glyphs=" + l ) ; } for ( int i = 0 ; i < psGlyphsBuffer . length ; i ++ ) { psGlyphsBuffer [ i ] = in . readTTFString ( in . readTTFUByte ( ) ) ; } //Set glyph names for ( int i = 0 ; i < l ; i ++ ) { if ( mtxTab [ i ] . getIndex ( ) < NMACGLYPHS ) { mtxTab [ i ] . setName ( Glyphs . MAC_GLYPH_NAMES [ mtxTab [ i ] . getIndex ( ) ] ) ; } else { if ( ! mtxTab [ i ] . isIndexReserved ( ) ) { int k = mtxTab [ i ] . getIndex ( ) - NMACGLYPHS ; if ( log . isTraceEnabled ( ) ) { log . trace ( k + " i=" + i + " mtx=" + mtxTab . length + " ps=" + psGlyphsBuffer . length ) ; } mtxTab [ i ] . setName ( psGlyphsBuffer [ k ] ) ; } } } break ; case 0x00030000 : // PostScript format 3 contains no glyph names log . debug ( "PostScript format 3" ) ; break ; default : log . error ( "Unknown PostScript format: " + postFormat ) ; } }
Read the post table containing the PostScript names of the glyphs .