List of usage examples for java.awt FontFormatException getMessage
public String getMessage()
From source file:PolyGlot.IOHandler.java
/** * Gets font from save file if possible, null otherwise * * @param _path The path of the PGD file * @return a Font object if the PGD file is both a zip archive and contains * a font//from w ww .jav a2 s. com * @throws java.io.IOException * @throws java.awt.FontFormatException */ public static Font getFontFrom(String _path) throws IOException, FontFormatException { Font ret = null; if (isFileZipArchive(_path)) { ZipFile zipFile = new ZipFile(_path); ZipEntry fontEntry = zipFile.getEntry(PGTUtil.fontFileName); if (fontEntry != null) { final File tempFile = File.createTempFile("stream2file", ".tmp"); tempFile.deleteOnExit(); FileOutputStream out = new FileOutputStream(tempFile); IOUtils.copy(zipFile.getInputStream(fontEntry), out); try { ret = Font.createFont(Font.TRUETYPE_FONT, tempFile); } catch (FontFormatException e) { throw new FontFormatException( "Could not load language font. Possible incompatible font: " + e.getMessage()); } catch (IOException e) { throw new FontFormatException("Could not load language font. I/O exception: " + e.getMessage()); } } } return ret; }