本人博客開始遷移,博客整個架構本身搭建及編碼 http://www.cookqq.com/listBlog.action java
使用activiti時候,圖片資源會出現亂碼問題,如圖:canvas
亂碼問題是困擾國人的第一大問題,神馬都出現亂碼,沒天理啊!架構
修改亂碼的方法:函數
(1)直接修改源碼:字體
org.activiti.engine.impl.bpmn.diagram.ProcessDiagramCanvas類的構造函數
protected String activityFontName = "Arial"; public ProcessDiagramCanvas(int width, int height) { this.canvasWidth = width; this.canvasHeight = height; if (Context.getProcessEngineConfiguration() != null) { this.activityFontName = Context.getProcessEngineConfiguration().getActivityFontName(); } this.processDiagram = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); this.g = processDiagram.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setPaint(Color.black); Font font = new Font(activityFontName, Font.BOLD, FONT_SIZE); g.setFont(font); this.fontMetrics = g.getFontMetrics(); }
把字體改成宋體就能夠了,這種方法是不推薦的,這個太不靈活了。this
(2)在配置文件activiti.cfg.xml中添加屬性(強烈推薦):編碼
<property name="activityFontName" value="宋體"></property>
這種方式有人說只能在5.12,可是我看了看5.11也可啊!spa
主要看ProcessEngineConfiguration類有沒有set方法:code
public void setActivityFontName(String activityFontName) { this.activityFontName = activityFontName; }