Graphviz Issue Tracker - graphviz
View Issue Details
0002586graphvizDotpublic2016-01-15 20:532016-02-09 14:22
0002586: Generated svg graph spans outside of the bounding box
This graph:

digraph graphname {
  "<TOP>" -> "R#1117/3-R#1118/2";

When rendered with this command:
$ dot -Tsvg -Efontsize=8 -Gsize=12,4\! -Gdpi=79 -Gbgcolor=transparent

Produces the svg file which spans outside its box. Ellipse is being clipped. This should never be the case because dot has the freedom to decide what geometry it generates.
No tags attached.
? ooo.svg (1,470) 2016-01-15 20:53
png dot-clipping-problem.png (19,713) 2016-01-15 20:55
Issue History
2016-01-15 20:53yurivictNew Issue
2016-01-15 20:53yurivictFile Added: ooo.svg
2016-01-15 20:55yurivictNote Added: 0001009
2016-01-15 20:55yurivictFile Added: dot-clipping-problem.png
2016-01-15 20:56yurivictNote Added: 0001010
2016-01-15 21:14northNote Added: 0001011
2016-01-15 21:28yurivictNote Added: 0001012
2016-02-09 14:22ellsonNote Added: 0001030

2016-01-15 20:55   
Attached the output svg.
2016-01-15 20:56   
I tried chrome, firefox, gimp. They all render the same way.
2016-01-15 21:14   
The difficulty is that plain SVG is in some sense underspecified (what exactly is font="Times,Serif"?) so there is some disparity between cairopango (or quartz) and whatever renderer is invoked by Firefox or Safari or Chrome. Not sure why, but you have proved that there is.

A solution is to use dot -Tsvg:cairo, which forces the glyphs to be written into the output so that graphviz and the renderer agree.

Is there a better way?

2016-01-15 21:28   
Using -Tsvg:cairo causes texts to turn into their pixelated representations. I don't think this is right.

Wikipedia has tons of svg images without any visible problems with them. How are svg images generated by graphviz any different?
2016-02-09 14:22   
The problem is related to the use of "-Gdpi=79" and the svg:core renderer.

I guess its a bug, but why would a user do this?

At this point "dpi" should be used only to provide a scaling for imported bitmap images. Something else is clearly happening here.

The problem does not happen with -Tsvg:cairo

BTW -Tsvg:cairo does not use pixelated fonts. Rather is renders fonts to vector glyphs based on fonts available on the host running dot, instead of assuming the existance of that same font on the machine rendering the SVG.