Lessons from working and playing with things like AWS, Ansible, and others
Problems with graphviz font selection
20 Mar 2014
When tweeting about my recent Ansible post
I mentioned that graphviz selection problems were the cause of some delay. @magneticnorth
responded that it was dismaying given the size of the underlying font handling libraries. So I thought I’d give a more detailed
Font selection in dot labels can be done a number of ways, but the resolution of the fonts (i.e.
what system fonts to use to render the fonts requested in the dotfile) is where things go wrong.
Here’s an example dot file:
And the results of the dot conversion (on a Fedora 20 machine with fairly standard fonts - it didn’t
go better on a different Fedora 20 machine with the MS core fonts installed):
There’s very little consistency or reason to why certain fonts resolve to DejaVu Sans and others resolve to non Bold versions.
Only “Times New Roman, Bold” resolves to anything reasonable. And that was thanks to a handy hint in a
graphviz bug report!
To be clear, I know it’s the underlying libraries that are most likely at fault rather than graphviz, but there is little
adequate documentation of how best to specify font selections (lots of FIXME notes in the graphviz font FAQ).
The FAQ did at least tell me how to know what fonts were being chosen, even if not why.