@@ -15,6 +15,9 @@ class DotGraphMachine:
1515 http://www.graphviz.org/doc/info/attrs.html#d:rankdir
1616 """
1717
18+ font_name = "Arial"
19+ """Graph font face name"""
20+
1821 state_font_size = "10pt"
1922 """State font size"""
2023
@@ -35,6 +38,7 @@ def _get_graph(self):
3538 "list" ,
3639 graph_type = "digraph" ,
3740 label = machine .name ,
41+ fontname = self .font_name ,
3842 fontsize = self .state_font_size ,
3943 rankdir = self .graph_rankdir ,
4044 )
@@ -58,6 +62,7 @@ def _initial_edge(self):
5862 self .machine .initial_state .id ,
5963 label = "" ,
6064 color = "blue" ,
65+ fontname = self .font_name ,
6166 fontsize = self .transition_font_size ,
6267 )
6368
@@ -90,6 +95,7 @@ def _state_as_node(self, state):
9095 label = f"{ state .name } { actions } " ,
9196 shape = "rectangle" ,
9297 style = "rounded, filled" ,
98+ fontname = self .font_name ,
9399 fontsize = self .state_font_size ,
94100 peripheries = 2 if state .final else 1 ,
95101 )
@@ -109,6 +115,7 @@ def _transition_as_edge(self, transition):
109115 transition .target .id ,
110116 label = f"{ transition .event } { cond } " ,
111117 color = "blue" ,
118+ fontname = self .font_name ,
112119 fontsize = self .transition_font_size ,
113120 )
114121
@@ -142,6 +149,7 @@ def quickchart_write_svg(sm: StateMachine, path: str):
142149 >>> sm = OrderControl()
143150 >>> print(sm._graph().to_string())
144151 digraph list {
152+ fontname=Arial;
145153 fontsize="10pt";
146154 label=OrderControl;
147155 rankdir=LR;
0 commit comments