Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002135graphvizOutput Generationpublic2011-09-01 21:422011-10-19 18:03
Assigned Toellson 
PrioritynormalSeverityfeatureReproducibilityhave not tried
PlatformOSOS Version
Summary0002135: Custom SVG node shapes do not show up in SVG output
DescriptionI'm trying to use a custom shape defined in an .svg file
for the nodes in my graph. My output format is SVG, and the input SVGs
have a viewBox so, at the very least, it should be possible to put the
content of the <svg> in the input file into a <symbol> tag, and <use>
that tag inside the <g> for the node. Currently, the <g> tags for the
nodes only have <title> tags inside them.
Steps To ReproduceInput file:

digraph G {
  gate_axb [id="gate_axb",shape=none,label="",image="and.svg"];
  gate_a [id="gate_a",shape=none,label="",image="and.svg"];
  gate_b [id="gate_b",shape=none,label="",image="and.svg"];
  gate_a -> gate_axb;
  gate_b -> gate_axb;
Additional InformationI also tried shape=custom and shapefile= instead of image=,
and I still couldn't get the custom shape to show up. I also tried not
setting shape to anything. I tried both -Tsvg:svg:core and
-Tsvg:cairo:cairo. I have attached the and.svg fle referenced in the

I get an error if I put the wrong file name in a node's
image attribute, so I think the backend reads the shape SVG. If my SVG
is missing something, please consider adding a check and printing a
warning to stderr. Otherwise, either implement the <symbol> / <use>
solution, or copy the <svg> contents inside the node's <g> tag.
TagsNo tags attached.
FIX-COMMENTResolved - unless further changes needed to support transform or * width,height
Attached Files? file icon and.svg [^] (842 bytes) 2011-09-01 21:42

- Relationships

-  Notes
User avatar (0000066)
erg (administrator)
2011-09-01 21:44

Reported for Victor Costan <[email protected]>.
User avatar (0000067)
erg (administrator)
2011-09-01 21:49

Re-open as feature request.
User avatar (0000068)
erg (administrator)
2011-09-01 21:52

The problem is that the svg image file does not contain supported
size information. It provides a viewbox and percentages for width and height,
which we don't currently support.
User avatar (0000070)
pwnall (reporter)
2011-09-04 17:36

Thank you very much for your answer!

In case anyone is interested in implementing this feature, the SVG specification describes how to translate the viewBox into an SVG transform, so the implementation could wrap the content around a <g transform="...">, and set width and height based on the viewBox size. [^]
User avatar (0000095)
ellson (administrator)
2011-10-19 18:01

I just made a change to take a size from viewBox if no absolute width,height available.

I didn't apply any transforms, or any % values from width height. This could probably be added if needed....

Changes were to svg_size() in lib/gvc/gvusershape.c

- Issue History
Date Modified Username Field Change
2011-09-01 21:42 erg New Issue
2011-09-01 21:42 erg Status new => assigned
2011-09-01 21:42 erg Assigned To => erg
2011-09-01 21:42 erg File Added: and.svg
2011-09-01 21:44 erg Note Added: 0000066
2011-09-01 21:45 erg Status assigned => closed
2011-09-01 21:45 erg Resolution open => fixed
2011-09-01 21:49 erg Assigned To erg =>
2011-09-01 21:49 erg Note Added: 0000067
2011-09-01 21:49 erg Status closed => feedback
2011-09-01 21:49 erg Resolution fixed => reopened
2011-09-01 21:52 erg Note Added: 0000068
2011-09-01 21:52 erg Status feedback => new
2011-09-01 21:52 erg Severity minor => feature
2011-09-04 17:36 pwnall Note Added: 0000070
2011-10-19 18:01 ellson Note Added: 0000095
2011-10-19 18:03 ellson FIX-COMMENT => Resolved - unless further changes needed to support transform or * width,height
2011-10-19 18:03 ellson Status new => resolved
2011-10-19 18:03 ellson Resolution reopened => fixed
2011-10-19 18:03 ellson Assigned To => ellson

MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker