nidi3 / graphviz-java

Use graphviz with pure java
Apache License 2.0
937 stars 107 forks source link

Cannot use Helvetica or Sans-Serif Fonts #200

Open justtheimpaler opened 3 years ago

justtheimpaler commented 3 years ago

Hi, I tried using Helvetica or Sans-Serif fonts but it doesn't work.

Example file:

digraph g {
  graph [fontname="sans-serif"];
  node [fontname="sans-serif"];
  edge [fontname="sans-serif"];
  label="Title SANS-SERIF"; 
  subgraph tree { 
    node_1 [label=<Node 1 Label>];
    node_2;
    node_1 -> node_2 [label="Edge Label"];    
  }
}

Result:

t1

As you can see, only the title is in Sans-Serif, while the nodes and edges are using Serif fonts.

I'm using OpenJDK 11 and the dependencies:

<dependency>
  <groupId>guru.nidi</groupId>
  <artifactId>graphviz-java</artifactId>
  <version>0.18.1</version>
</dependency>

<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-core</artifactId>
  <version>2.13.0</version>
</dependency>
<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-slf4j-impl</artifactId>
  <version>2.13.0</version>
</dependency>

Let me know if you want me to test anything else.