public void save(OutputStream output) throws IOException {
    DataOutputStream os = new DataOutputStream(output);

    os.writeInt(charCount);

    if ((name == null) || (psname == null)) {
      name = "";
      psname = "";
    }
    // formerly numBits, now used for version number
    //os.writeInt((name != null) ? 11 : 8);
    os.writeInt(11);

    os.writeInt(size);    // formerly mboxX (was 64, now 48)
    os.writeInt(mbox2);   // formerly mboxY (was 64, still 64)
    os.writeInt(ascent);  // formerly baseHt (was ignored)
    os.writeInt(descent); // formerly struct padding for c version

    for (int i = 0; i < charCount; i++) {
      os.writeInt(value[i]);
      os.writeInt(height[i]);
      os.writeInt(width[i]);
      os.writeInt(setWidth[i]);
      os.writeInt(topExtent[i]);
      os.writeInt(leftExtent[i]);
      os.writeInt(0); // padding
    }

    for (int i = 0; i < charCount; i++) {
      for (int y = 0; y < height[i]; y++) {
        for (int x = 0; x < width[i]; x++) {
          os.write(images[i].pixels[y * mbox2 + x] & 0xff);
        }
      }
    }

    //if (name != null) {  // version 11
    os.writeUTF(name);
    os.writeUTF(psname);
    os.writeBoolean(smooth);
    //}

    os.flush();
  }