解决方案 »
- webservice远程调用问题
- java正则表达式匹配<vfd:textbox class=""></vfd:textbox>
- 请教MyEclipse 6.0配置问题
- 请问以SSH框架为主的话,如果要用sql查询,一般用什么方法
- 用Java axis 部署的web service,其它语言怎么调用啊?
- 请教在eclipse3.1+myeclipse4.0中运行程序报的什么错啊?该怎样改才行啊?能不能说说具体的改的步骤啊?谢谢!
- hibernate的查询!!!!在线等
- [求助]SAX读取XML的问题
- 新人报道!散分并问个问题,(详细点)怎样把jboss ide装到eclipse上
- j2ee 在 linux 下的怎莫用???:
- java执行oracle备份命令总失败, why
- RMI在linux开启端口花了好几分钟 怎么解决?
我的项目文件整体都是UTF-8的,你说的这个问题不存在。
* 把字符印到图片上
* @param imgPath 图片路径(物理路径)
* @param text 准备的字符
* @param font 字体样式
* @param color 字体颜色
* @param left 图片的x坐标 (印的位置)
* @param top 图片的y坐标 (印的位置)
*/
public void fontImg(String imgPath, String text, Font font, Color color, int left, int top) {
try {
BufferedImage src = ImageIO.read(new File(imgPath));
int width = src.getWidth();
int height = src.getHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics graph = image.createGraphics();
graph.drawImage(src, 0, 0, width, height, null);
graph.setColor(color);
graph.setFont(font);
graph.drawString(text, left, top);
graph.dispose();
FileOutputStream out = new FileOutputStream(imgPath);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(image);
out.close();
image.flush();
src.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
Linux上有宋体吗?
Linux上需要安装中文字体,
JRE里面也要安装中文字体的,
在$JAVA_HOME/jre/lib/fonts下新建一个fallback目录,复制程序用到的字体进去。
参考资料:http://ginge.iteye.com/blog/640693