private void createHead(FontFileReader in) throws IOException {
        TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("head");
        if (entry != null) {
            pad4();
            seekTab(in, "head", 0);
            System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
                             0, output, currentPos, (int)entry.getLength());

            checkSumAdjustmentOffset = currentPos + 8;
            output[currentPos + 8] = 0;     // Set checkSumAdjustment to 0
            output[currentPos + 9] = 0;
            output[currentPos + 10] = 0;
            output[currentPos + 11] = 0;
            output[currentPos + 50] = 0;    // long locaformat
            output[currentPos + 51] = 1;    // long locaformat

            int checksum = getCheckSum(currentPos, (int)entry.getLength());
            writeULong(headDirOffset, checksum);
            writeULong(headDirOffset + 4, currentPos);
            writeULong(headDirOffset + 8, (int)entry.getLength());

            currentPos += (int)entry.getLength();
            realSize += (int)entry.getLength();
        } else {
            throw new IOException("Can't find head table");
        }
    }
private void createHead ( FontFileReader in ) throws IOException { TTFDirTabEntry entry = ( TTFDirTabEntry ) dirTabs . get ( "head" ) ; if ( entry != null ) { pad4 ( ) ; seekTab ( in , "head" , 0 ) ; System . arraycopy ( in . getBytes ( ( int ) entry . getOffset ( ) , ( int ) entry . getLength ( ) ) , 0 , output , currentPos , ( int ) entry . getLength ( ) ) ; checkSumAdjustmentOffset = currentPos + 8 ; output [ currentPos + 8 ] = 0 ; output [ currentPos + 9 ] = 0 ; output [ currentPos + 10 ] = 0 ; output [ currentPos + 11 ] = 0 ; output [ currentPos + 50 ] = 0 ; output [ currentPos + 51 ] = 1 ; int checksum = getCheckSum ( currentPos , ( int ) entry . getLength ( ) ) ; writeULong ( headDirOffset , checksum ) ; writeULong ( headDirOffset + 4 , currentPos ) ; writeULong ( headDirOffset + 8 , ( int ) entry . getLength ( ) ) ; currentPos += ( int ) entry . getLength ( ) ; realSize += ( int ) entry . getLength ( ) ; } else { throw new IOException ( "Can't find head table" ) ; } }
Copy the head table as is from original font to subset font
and set indexToLocaFormat to long and set
checkSumAdjustment to 0, store offset to checkSumAdjustment
in checkSumAdjustmentOffset

@param in The reader to read the HEAD table from
@throws IOException Failure to read the table