List of usage examples for com.lowagie.text.pdf BaseFont RESOURCE_PATH
String RESOURCE_PATH
To view the source code for com.lowagie.text.pdf BaseFont RESOURCE_PATH.
Click Source Link
From source file:net.bull.javamelody.internal.web.pdf.PdfFonts.java
License:Apache License
/** * Chargement des cjkfonts et cjkencodings. <br/> * Les fichiers cjkfonts.properties et cjkencoding.properties ont t renomms <br/> * pour que FlyingSaucer ne croit pas qu'iTextAsian.jar est prsent (issue 258). <br/> * Cette mthode se charge de charger quand mme les fichiers renomms pour la fonte en langue chinoise. *//*from w ww . j ava 2 s . c om*/ private static void loadCJKFonts() { try { final Class<?> cjkFontClass = Class.forName("com.lowagie.text.pdf.CJKFont"); final Field cjkFontsField = cjkFontClass.getDeclaredField("cjkFonts"); final Field cjkEncodingsField = cjkFontClass.getDeclaredField("cjkEncodings"); cjkFontsField.setAccessible(true); cjkEncodingsField.setAccessible(true); final Properties cjkFonts = (Properties) cjkFontsField.get(null); final Properties cjkEncodings = (Properties) cjkEncodingsField.get(null); if (cjkFonts.isEmpty()) { final InputStream is = BaseFont .getResourceStream(BaseFont.RESOURCE_PATH + "cjkfonts.properties.renamedForIssue258"); try { cjkFonts.load(is); } finally { is.close(); } } if (cjkEncodings.isEmpty()) { final InputStream is = BaseFont .getResourceStream(BaseFont.RESOURCE_PATH + "cjkencodings.properties.renamedForIssue258"); try { cjkEncodings.load(is); } finally { is.close(); } } } catch (final Exception e) { throw new IllegalStateException(e); } }