Dotty shows all labels as dots (period) instead of text

7

I have the following graphviz graph:

digraph finite_state_machine {
    a -> b [ label = "c" ];
}

The output of this graph should be

correct graph

And this is indeed what I get if I try to use dot to generate a file (e.g. by dot -Tsvg test.dot > test.svg).

When I try to use dotty to display it, however, all the labels appear as periods:

incorrect graph

What causes this problem, and how can I solve this? I have used dotty a lot in the past on similar graphs, both on Windows and on Linux, and never saw this behavior.

Ubuntu 10.04.3 LTS, Graphviz version 2.20.2 (dotty version 96c).

Oak

Posted 2011-09-12T12:02:36.043

Reputation: 1 255

1Are the right fonts installed? – Sardathrion - against SE abuse – 2011-09-12T13:17:12.203

@Sard I don't know, how can I check? – Oak – 2011-09-12T13:18:45.717

Have a look at $HOME/.xsession-errors and/or /var/log/Xorg.0.log to see if there are errors there. Start dotty in a console (so you can see any messages send to stderr). Look at what fonts you have installed and force a font in the dot file to see if it makes any difference. – Sardathrion - against SE abuse – 2011-09-12T14:09:44.670

1sounds like a missing font to me. – RobotHumans – 2011-09-20T14:30:26.150

Answers

5

My solution is too simple. I examined /var/log/Xorg.0.log and found the following:

[    52.308] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    52.308]    Entry deleted from font path.
[    52.308] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[    52.308]    Entry deleted from font path.
...
[    52.314] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[    52.314]    Entry deleted from font path.
[    52.314] (WW) The directory "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" does not exist.
[    52.314]    Entry deleted from font path.

So, I installed the indicated packages:

xfonts-100dpi
xfonts-cyrillic
...
defoma
psfontmgr
x-ttcidfont-conf

I rebotted and Dotty graphs became beautiful, but the default font name remains unknown for me.

dyomas

Posted 2011-09-12T12:02:36.043

Reputation: 151

According to this bug report, installing xfonts-100dpi should be enough to avoid the issue.

– anol – 2017-04-07T09:31:47.320

2

I have the same issue and did not find a solution yet, but I compiled a list of workarounds (some taken from https://bugs.launchpad.net/ubuntu/+source/graphviz/+bug/1016777):

  1. Specify a font name (attribute fontname="fixed" worked for me). Note that you can use global attributes in the beginning of the file to avoid having to specify it for every label:
  digraph cfg {
    graph [fontname="fixed"];
    node [fontname="fixed"];
    edge [fontname="fixed"];
    ...
  }
  1. Use dot (instead of dotty) and output the graph to an image file (e.g. dot -Tpng file.dot -o file.png), then use an image viewer. To avoid creating temporary files, use a viewer which supports reading from stdin, such as gwenview (e.g. dot -Tpng file.dot | gwenview /dev/stdin).

  2. Use xdot instead of dotty.

While these workarounds do not solve the actual issue, if all you need is to quickly view some graphs, they may be faster than trying to fix the issue (which still persists in Linux Mint 17, based on Ubuntu 14.04).

anol

Posted 2011-09-12T12:02:36.043

Reputation: 1 291

0

As others have mentioned your font configuration isn't working. You can read more about how to configure that here:

http://www.graphviz.org/doc/info/attrs.html#d:fontname

polynomial

Posted 2011-09-12T12:02:36.043

Reputation: 1 424

I tried forcing specific fonts and I tried manually installing fonts used by graphviz - neither helped. I also think that the fact dot does work, just dotty doesn't, hints that this isn't a font issue – Oak – 2011-11-01T14:01:20.677

0

I've found some internal document in a company I briefly worked for that mentioned dotty is faulty on Ubuntu 10.04, and urging users to upgrade their OS as a way to solve that. The reason this happens is still a mystery to me, and "upgrade your OS" is a pretty poor solution, but still - it should solve the issue, so posting it here as an answer.

Oak

Posted 2011-09-12T12:02:36.043

Reputation: 1 255

Seeing as the bug it still present in Ubuntu 16.04, this advice is no longer accurate neither helpful, since it does not solve the issue. It might be better to choose another answer as accepted. – anol – 2017-04-07T09:27:11.043

1@anol fair enough, but to be honest the other solutions did not help me at the time either. – Oak – 2017-04-07T17:13:51.990

Oh I see, I hadn't paid much attention to all the dates. However, I believe that dyomas' answer is still up-to-date and the best one so far. – anol – 2017-04-08T19:59:49.620