On 2013-12-24 03:35 +0100, su_v wrote:
On 2013-12-22 21:34 +0100, Campbell Barton wrote:
Hi, we have some icons which are made in inkscape but render differently in RSVG,
Most (all?) of the applications on Linux are using RSVG, so I was wondering if there is a good way to determine if this is some special inkscape feature or a bug/limitation in RSVG.
Comparison:
http://git.blender.org/gitweb/gitweb.cgi/blender.git/blob_plain/HEAD:/releas... http://git.blender.org/gitweb/gitweb.cgi/blender.git/blob_plain/HEAD:/releas...
Note that RSVG seems to fail on groups that have alpha masking.
It appears that librsvg doesn't handle Inkscape's <mask> notation well: when creating a <mask> element, Inkscape always defines 'maskUnits="userSpaceOnUse"' [1], but not the properties 'x', 'y', 'width', 'height' (for the "largest possible offscreen buffer").
AFAICT the SVG 1.1 spec defines relative fallback values (x, y: -10%, width, height: 120%) if the position and size properties are not defined [2], but it's unclear to me how those relate to maskUnits 'userSpaceOnUse'.
librsvg doesn't appear to use fallback values if maskUnits are 'userSpaceOnUse' (setting them explicitly makes the masked objects reappear). If maskUnits are 'objectBoundingBox', or omitted entirely, librsvg renders the masked objects as expected, whether or not position and size of the offscreen buffer are explicitly defined or not.
There's second issue librsvg appears to have with masks in Inkscape-generated SVG files:
Gradients referenced in mask definitions have to be defined earlier, otherwise librsvg doesn't find them and omits the masked objects.
Attached sample files: - test2.svg sample affected icon extracted from blender_icons.svg - test2-gradient-defs-before-mask-def.svg changed stack order of elements in <defs> section - test2-gradient-defs-before-mask-def-no-maskUnits.svg maskUnits ('userSpaceOnUse') removed as workaround (see earlier message)
Only the third version renders with librsvg as expected.