pptを画像化した時に日本語が□になってしまうのをどうにかする
ちょっと古い記事だけど
http://experiment.blog.so-net.ne.jp/2010-02-01
http://d.hatena.ne.jp/kawam/20060828
以下このサイトを参考にした使えるフォントチェックのコード
http://www2b.biglobe.ne.jp/~daisu-n/mania.html
Font [] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); //draw string by default font graphics.setColor(new Color(0, 0, 0)); String env = System.getProperty("os.name") + ":" + System.getProperty("java.version") + ":" + System.getProperty("file.encoding"); graphics.drawString(graphics.getFont().canDisplay('あ') + ":" + graphics.getFont().getName() + ":" + "日日本語が使えるノカ!?" + env, 0, 20); System.out.println(graphics.getFont().canDisplay('あ') + ":" + graphics.getFont().getName() + ":" + "日本語が使えるノカ!?" + env); //draw string by all fonts graphics.setColor(new Color(255, 255, 255)); int a = 0; for(int k = 0; k < fonts.length; k++){ if(!fonts[k].canDisplay('あ')) { graphics.setColor(new Color(0, 0, 0)); graphics.setFont(new Font(fonts[k].getName(), Font.PLAIN, 20)); graphics.drawString(k + " : " + fonts[k].canDisplay('あ') + ":" + fonts[k].getName() + ":" + "日本語が使えるノカ!?", 0, (a+2)*20); System.out.println(k + " : " + fonts[k].canDisplay('あ') + ":" + fonts[k].getName() + ":" + "日本語が使えるノカ!?"); a++; } }
private static Graphics2D rendering(BufferedImage img,int width,int height) { Graphics2D graphics = img.createGraphics(); Font font = new Font("Lucida Bright Regular", Font.PLAIN, 12); graphics.setFont(font); System.out.println(graphics.getFont().getName() + ":日本語が使えるノカ!?"); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); graphics.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY); graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC); graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,RenderingHints.VALUE_FRACTIONALMETRICS_ON); graphics.setColor(Color.white); graphics.clearRect(0,0,width,height); return graphics; }