public void setData(ByteBuffer data) {
        // some PDF writers subset the font but don't update the number of glyphs in the maxp table,
        // this would appear to break the TTF spec.
        // A better solution might be to try and override the numGlyphs in the maxp table based
        // on the number of entries in the cmap table or by parsing the glyf table, but this
        // appears to be the only place that gets affected by the discrepancy... so far!...
        // so updating this allows it to work.
        int i;
        // only read as much data as is available
        for (i = 0; i < leftSideBearings.length && data.hasRemaining(); i++) {
            if (i < advanceWidths.length) {
                advanceWidths[i] = data.getShort();
            }
            
            leftSideBearings[i] = data.getShort();
        }
        // initialise the remaining advanceWidths and leftSideBearings to 0
        if (i < advanceWidths.length) {
            Arrays.fill(advanceWidths, i, advanceWidths.length-1, (short) 0);
        }
        if (i < leftSideBearings.length) {
            Arrays.fill(leftSideBearings, i, leftSideBearings.length-1, (short) 0);
        }
    }