code: private void createHmtx(FontFileReader in,
                              Map glyphs) throws IOException {
          TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("hmtx");
  
          int longHorMetricSize = glyphs.size() * 2;
          int leftSideBearingSize = glyphs.size() * 2;
          int hmtxSize = longHorMetricSize + leftSideBearingSize;
  
          if (entry != null) {
              pad4();
              //int offset = (int)entry.offset;
              Iterator e = glyphs.keySet().iterator();
              while (e.hasNext()) {
                  Integer origIndex = (Integer)e.next();
                  Integer subsetIndex = (Integer)glyphs.get(origIndex);
  
                  writeUShort(currentPos + subsetIndex.intValue() * 4,
                              mtxTab[origIndex.intValue()].getWx());
                  writeUShort(currentPos + subsetIndex.intValue() * 4 + 2,
                              mtxTab[origIndex.intValue()].getLsb());
              }
  
              int checksum = getCheckSum(currentPos, hmtxSize);
              writeULong(hmtxDirOffset, checksum);
              writeULong(hmtxDirOffset + 4, currentPos);
              writeULong(hmtxDirOffset + 8, hmtxSize);
              currentPos += hmtxSize;
              realSize += hmtxSize;
          } else {
              throw new IOException("Can't find hmtx table");
          }
      }
docs: Create the hmtx table by copying metrics from original
  font to subset font. The glyphs Map contains an
  Integer key and Integer value that maps the original
  metric (key) to the subset metric (value)
  
  @param in The reader from which to grab the HMTX table
  @param glyphs The glyphs table to populate
  @throws IOException Indicates a failure to read