Write this PFont to an OutputStream. This is used by the Create Font tool, or whatever anyone else dreams up for messing with fonts themselves. It is assumed that the calling class will handle closing the stream when finished.
(OutputStream output)
| 413 | * the stream when finished. |
| 414 | */ |
| 415 | public void save(OutputStream output) throws IOException { |
| 416 | DataOutputStream os = new DataOutputStream(output); |
| 417 | |
| 418 | os.writeInt(glyphCount); |
| 419 | |
| 420 | if ((name == null) || (psname == null)) { |
| 421 | name = ""; |
| 422 | psname = ""; |
| 423 | } |
| 424 | |
| 425 | os.writeInt(11); // formerly numBits, now used for version number |
| 426 | os.writeInt(size); // formerly mboxX (was 64, now 48) |
| 427 | os.writeInt(0); // formerly mboxY, now ignored |
| 428 | os.writeInt(ascent); // formerly baseHt (was ignored) |
| 429 | os.writeInt(descent); // formerly struct padding for c version |
| 430 | |
| 431 | for (int i = 0; i < glyphCount; i++) { |
| 432 | glyphs[i].writeHeader(os); |
| 433 | } |
| 434 | |
| 435 | for (int i = 0; i < glyphCount; i++) { |
| 436 | glyphs[i].writeBitmap(os); |
| 437 | } |
| 438 | |
| 439 | // version 11 |
| 440 | os.writeUTF(name); |
| 441 | os.writeUTF(psname); |
| 442 | os.writeBoolean(smooth); |
| 443 | |
| 444 | os.flush(); |
| 445 | } |
| 446 | |
| 447 | |
| 448 | /** |
no test coverage detected