cancel
Showing results for 
Search instead for 
Did you mean: 

how can i generate diagram for asian font ??

ozhuang
Champ in-the-making
Champ in-the-making

this is my config:
   
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="databaseType" value="h2" />
      <property name="dataSource" ref="dataSource" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="databaseSchemaUpdate" value="true" />
      <property name="jobExecutorActivate" value="false" />
       
        <property name="activityFontName" value="asian font"/>
        <property name="labelFontName" value="asian font"/>
   </bean>
==============================

this is my code:

String filename="F:/Users/Administrator/workspace_workflow/activiti tu/src/main/resources/pms_template/ONE.bpmn";
      
       System.out.println(processEngineConfiguration.getActivityFontName());
       System.out.println(processEngineConfiguration.getLabelFontName());      
      
       byte[] bytes_s=Files.readAllBytes(new File(filename).toPath());
      
       BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
       BpmnModel  bpmnModel=bpmnXMLConverter.convertToBpmnModel(new BytesStreamSource(bytes_s), false, false); // no need to validate schema, it was already validated on deploy
      
       InputStream is = ProcessDiagramGenerator.generateDiagram(
                   bpmnModel, "png", Collections.EMPTY_LIST);

      File file = new File("F:/Users/Administrator/workspace_workflow/activiti tu/src/main/resources/pms_template/ONE.png");
      OutputStream  outputStream = new FileOutputStream(file);

      int read = 0;
      byte[] bytes = new byte[1024];

      while ((read = is.read(bytes)) != -1) {
         outputStream.write(bytes, 0, read);
      }
      outputStream.close();   

===================
this is my  generated diagram,

http://static.oschina.net/uploads/space/2013/0328/172838_wDCI_200838.png

it is bad  font display and can't read…..
2 REPLIES 2

ozhuang
Champ in-the-making
Champ in-the-making
i already set processEngineConfiguration property "activityFontName" && "labelFontName" to  asian font  name.
It is still bad font display……..
how can i fix it?
please help me!

ozhuang
Champ in-the-making
Champ in-the-making
i have fix it ,
i added flow code :

Context.setProcessEngineConfiguration((ProcessEngineConfigurationImpl)processEngineConfiguration);

i worked good!