How to correctly use dot -q to suppress warnings or help with accents in a dot file?

Hi all

I am running dot graphviz version 8.1.0 (20230707.0739) on Ubuntu, and I’d like to be able use -q to suppress warnings that we’re seeing when trying to create SVGs. For example:

 /usr/local/bin/dot -q -Tsvg /tmp/wf-broken.dot
 Warning: no value for width of ASCII character 13. Falling back to 0
 Warning: no value for width of non-ASCII character 195. Falling back to width of space character
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 <!-- Generated by graphviz version 8.1.0 (20230707.0739)

I’ve tried different variations e.g. -q2 and also putting it at the end of the command. But it still shows the warnings?

Any tips?
Thanks!

Incidentally the source of this warning is an accent in the label of a node. I know Graphviz supports UTF-8 so I’m starting to wonder now what is triggering this warning. It worked fine on an earlier Graphviz version on Windows.

I’ve attached the dot file if anyone would like to comment. This was the command used:

/usr/local/bin/dot -Tsvg /tmp/bad-accent.dot

bad-accent.dot (1.4 KB)

Hmm, I get no warnings or errors on either Windows or Ubuntu (Ubuntu 20.04.6 LTS).
I guess that may mean that it is caused by a (dreaded) (pita) “font problem” (Font FAQ | Graphviz).
Adding -v to the command line may provide help, especially font-related. Here is what I got (stderr):

dot - graphviz version 9.0.1~dev.20230922.2220 (20230922.2220)
libdir = "/home/csr/lib/graphviz"
Activated plugin library: libgvplugin_core.so.6
Using render: svg:core
Using device: svg:svg:core
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
The plugin configuration file:
        /home/csr/lib/graphviz/config6
                was successfully loaded.
    render      :  cairo dot dot_json fig gd json json0 map mp pic pov ps svg tk visio vrml xdot xdot_json
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  bmp canon cmap cmapx cmapx_np dot dot_json eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg json json0 kitty kittyz mp pdf pic plain plain-ext png pov ps ps2 svg svgz tga tif tiff tk vdx vrml vt vt-24bit vt100 vt100-24bit wbmp x11 xdot xdot1.2 xdot1.4 xdot_json xlib
    loadimage   :  (lib) eps gd gd2 gif jpe jpeg jpg png ps svg xbm
pack info:
  mode   undefined
  size   0
  flags  0
  margin 8
pack info:
  mode   node
  size   0
  flags  0
fontname: "arial" resolved to: (PangoCairoFcFont) "Liberation Sans, Regular" /usr/share/fonts/truetype/liberation2/LiberationSans-Regular.ttf
network simplex:  3 nodes 2 edges maxiter=2147483647 balance=1
network simplex: 3 nodes 2 edges 0 iter 0.00 sec
network simplex:  1 nodes 0 edges maxiter=2147483647 balance=1
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
Maxrank = 2, minrank = 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross workflow: 0 crossings, 0.00 secs.
network simplex:  6 nodes 5 edges maxiter=2147483647 balance=2
network simplex: 6 nodes 5 edges 0 iter 0.00 sec
routesplines: 2 edges, 6 boxes 0.00 sec
Using render: svg:core
Using device: svg:svg:core
gvRenderJobs workflow: 0.00 secs.

None of this answers why -q does not suppress warnings. I suggest creating a bug report on the -q problem.

1 Like

There’s certainly some -q problems, -q doesn’t silence hard coded metrics fallback warnings (#2379) · Issues · graphviz / graphviz · GitLab

Thanks @steveroush for the tips. Below is the output when run with -v.


/usr/local/bin/dot -v -Tsvg /tmp/bad-accent.dot
dot - graphviz version 8.1.0 (20230707.0739)
libdir = "/usr/local/lib/graphviz"
Activated plugin library: libgvplugin_core.so.6
Using render: svg:core
Using device: svg:svg:core
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
The plugin configuration file:
        /usr/local/lib/graphviz/config6
                was successfully loaded.
    render      :  dot dot_json fig json json0 map mp pic pov ps svg tk xdot xdot_json
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  : 
    device      :  canon cmap cmapx cmapx_np dot dot_json eps fig gv imap imap_np ismap json json0 mp pic plain plain-ext pov ps ps2 svg svgz tk xdot xdot1.2 xdot1.4 xdot_json
    loadimage   :  (lib) eps gif jpe jpeg jpg png ps svg
pack info:
  mode   undefined
  size   0
  flags  0
  margin 8
pack info:
  mode   node
  size   0
  flags  0
fontname: "arial" resolved to: [internal hard-coded]
Warning: no value for width of non-ASCII character 195. Falling back to width of space character
network simplex:  3 nodes 2 edges maxiter=2147483647 balance=1
network simplex: 3 nodes 2 edges 0 iter 0.00 sec
network simplex:  1 nodes 0 edges maxiter=2147483647 balance=1
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
Maxrank = 2, minrank = 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross workflow: 0 crossings, 0.00 secs.
network simplex:  6 nodes 5 edges maxiter=2147483647 balance=2
network simplex: 6 nodes 5 edges 0 iter 0.00 sec
routesplines: 2 edges, 6 boxes 0.00 sec
Using render: svg:core
Using device: svg:svg:core
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 8.1.0 (20230707.0739)

It looks you are correct that there is a font issue. I was hoping to avoid having to build Graphviz with Arial as I seem to recall that giving me a real headache last time I tried it (something to do with Microsoft making it difficult to include in Docker builds). We’re certainly happy to use another font instead of Arial, but even with “Times-Roman” I am getting that same “Warning: no value for width of non-ASCII character 195. Falling back to width of space character”. I understand that Times-Roman is the default Graphviz font, so surely that should work?

I also tried Noto and Dejavu fonts which are listed in the output of fc-list, but still have problems e.g.

Warning: no hard-coded metrics for 'Noto Sans Mono'.  Falling back to 'Times' metrics
fontname: "Noto Sans Mono" resolved to: [internal hard-coded]
Warning: no value for width of non-ASCII character 195. Falling back to width of space character

This is despite ‘Noto Sans Mono’ being listed in fc-list:

fc-list |grep -i "noto sans"
/usr/share/fonts/truetype/noto/NotoSansMono-Regular.ttf: Noto Sans Mono:style=Regular
/usr/share/fonts/truetype/noto/NotoSansMono-Bold.ttf: Noto Sans Mono:style=Bold

Regarding the -q, @smattr that was actually me who initialy made that bug report on a separate issue a few months back! If there is a fix by using correct fonts then maybe I won’t need to use -q

thanks for great support everyone!