private void createDirectory ( ) { int numTables = 9 ; // Create the TrueType header writeByte ( ( byte ) 0 ) ; writeByte ( ( byte ) 1 ) ; writeByte ( ( byte ) 0 ) ; writeByte ( ( byte ) 0 ) ; realSize += 4 ; writeUShort ( numTables ) ; realSize += 2 ; // Create searchRange, entrySelector and rangeShift int maxPow = maxPow2 ( numTables ) ; int searchRange = maxPow * 16 ; writeUShort ( searchRange ) ; realSize += 2 ; writeUShort ( maxPow ) ; realSize += 2 ; writeUShort ( ( numTables * 16 ) - searchRange ) ; realSize += 2 ; // Create space for the table entries writeString ( "cvt " ) ; cvtDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; if ( hasFpgm ( ) ) { writeString ( "fpgm" ) ; fpgmDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; } writeString ( "glyf" ) ; glyfDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; writeString ( "head" ) ; headDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; writeString ( "hhea" ) ; hheaDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; writeString ( "hmtx" ) ; hmtxDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; writeString ( "loca" ) ; locaDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; writeString ( "maxp" ) ; maxpDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; writeString ( "prep" ) ; prepDirOffset = currentPos ; currentPos += 12 ; realSize += 16 ; }
Create the directory table