GNOME Bugzilla – Bug 520654
add --export-id paramater
Last modified: 2017-12-13 17:30:56 UTC
Inkscape allows to export a specific area by passing an object id on the commandline. This is extremely useful for 'cropping' out a large SVG into smaller chunks. The reason I humbly request this to be added in rsvg as well is that inkscape is a rather unreasonable dependency for doing build-time rendering for an icon theme. Depending on rsvg is much more sane. The two options that are interesting: -i, --export-id=ID The ID of the object to export -j, --export-id-only Export just the object with export-id, hide all others (only with export-id) the -x -y -w -h parameters should be respected even when -i is passed.
The behavior has been implemented with the --export-id parameter in https://git.gnome.org/browse/librsvg/commit/?id=fecfcce44a959daff80a4e0f9ced83d7cdcb5903 However few things need to be addressed before this can get used in adwaita-icon-theme (wip/rsvg-cropping branch): - all cropped rectangles are 20x20 rather than 16x16px the original group had (pt vs px). - some icons have completely wild canvas size - special class attributes aren't retained (used for special coloring on gtk side, e.g class="warning") The last one not being a blocker and having a lot lower priority than the other two.
This changed the behavior of the -w and -h parameters on the command line, when given with nothing else. Before, doing rsvg-convert -w 48 -h 48 would scale, now it crops.
And in fact, this regression is all caused by the "In addition, this get rid of a deprecated call to rsvg_handle_set_size_callback()" part of the commit.
It turns out the cairo surface is never set up properly to do the scaling, and the code was kind of relying on the rsvg_handle_set_size_callback call to set things up.
And in fact, more than -w/-h are broken. -x and -y are equally broken.
Jakub, do you have any feedback on this?
FYI: I reverted this commit in the Debian librsvg package until a proper solution is found upstream.
I filed a separate bug for this: https://bugzilla.gnome.org/show_bug.cgi?id=762115
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/16.