How to solve the problem of Chinese garbled codes in activiti
This article introduces the relevant knowledge of "how to solve the problem of garbled codes in activiti". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Garbled image resources may occur when using activiti, as shown in the figure:
The problem of garbled code is the first big problem that puzzles the Chinese people. There are all garbled codes.
How to modify garbled code:
(1) modify the source code directly:
Constructor of the org.activiti.engine.impl.bpmn.diagram.ProcessDiagramCanvas class
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 ();}
Just change the font to Song style, this method is not recommended, this is too inflexible.
(2) add attributes to the configuration file activiti.cfg.xml (highly recommended):
In this way, some people say that it can only be on 5.12, but I have seen it on 5.11.
It mainly depends on whether the ProcessEngineConfiguration class has a set method:
Public void setActivityFontName (String activityFontName) {this.activityFontName = activityFontName;} "how to solve the problem of garbled codes in activiti" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!