}
}
out.close();
pageIndex = 0;
ImageIOWriter imageWriter = new ImageIOWriter();
for (Iterator pageIter = unicodeFont.getGlyphPages().iterator(); pageIter.hasNext();) {
GlyphPage page = (GlyphPage)pageIter.next();
String fileName;
if (pageIndex == 0 && !pageIter.hasNext())
fileName = outputName + ".png";
else
fileName = outputName + (pageIndex + 1) + ".png";
File imageOutputFile = new File(outputDir, fileName);
FileOutputStream imageOutput = new FileOutputStream(imageOutputFile);
try {
imageWriter.saveImage(page.getImage(), "png", imageOutput, true);
} finally {
imageOutput.close();
}
// Flip output image.
Image image = new ImageIcon(imageOutputFile.getAbsolutePath()).getImage();