Graphviz: change font for the whole graph?

pirkil picture pirkil · Jun 4, 2012 · Viewed 31.4k times · Source

I am wondering if I can define an alternative font for the whole graph.

...
digraph script_concept {
graph [layout="dot",fontname="helvetica"];
...

According to this 1 older post the fontname atribute can be defined only separately:

Nodes and edges don't inherit the font of the graph, you need to specify them separately

Is there any other way, how to define the font globally?

Answer

marapet picture marapet · Jun 4, 2012

No, there is no other way.

As in the forum post you linked, you have to define the default values separately (like the other attributes) at the beginning of your graphviz file:

digraph g {
 graph [fontname = "helvetica"];
 node [fontname = "helvetica"];
 edge [fontname = "helvetica"];
 ...
}