Less verbose markup, dont write unnecessary styles

Bug #170184 reported by Horkana-users
4
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Low
Unassigned

Bug Description

inkscape markup

I had previously noticed that Sodipodi added a whole
lot of unnecessary extra markup and I decided to see if
Inkscape did the same and to document what I found.

Looking at the markup of icons.svg
(having first converted it to Standard SVG)
I noticed quite a lot of extra markup.

if
stop-opacity:1;
then
why write it, unless explicitly set?

if fill:none;
then
why write
it or why also write 'fill-rule:evenodd;'?

many font styles are being set over and over again for
groups that dont actually contain any text.

although it doesn't occur in the icons.svg document the
same goes for
stroke:none;stroke-width:3pt;
no need to stroke-width if there is no stroke.

the icons.svg file also contains a lot of unnecessary
blank gradients but this may just be due to the artist
using inkscape in a particular way, but it would be
helpful if there were easier wasy to determine which
gradients were unused and remove them.

I also considered that this information might be useful
for Undoing changes but when I thought about it some
more I figured the Undo system should be able to keep
track without cluttering the markup with redundant
information.

Revision history for this message
Kidproto (kidproto) wrote :

Also, it would be good to have a cleanup SVG command to get
rid of unneccesary definitions, gradients, styles, markers
from a document.

Might even be good to have the option in preferences to
prune out unnecessary on leaving the app. A toggle switch.

Jon

Revision history for this message
Horkana-users (horkana-users) wrote :

this came up again in a discussion on styles support in inkscape
https://sourceforge.net/mailarchive/message.php?msg_id=36789236

Revision history for this message
Ryan Lerch (ryanlerch) wrote :

Thank you for taking the time to report this bug and helping to make Inkscape better. You reported this bug a long while ago and there hasn't been any activity in it recently. We were wondering is this still an issue for you? Can you try with latest Inkscape release? Thanks in advance.

Changed in inkscape:
status: New → Incomplete
Ryan Lerch (ryanlerch)
Changed in inkscape:
status: Incomplete → Invalid
Revision history for this message
Martin Andersen (msandersen) wrote :

bug#212077 seems to be partially a duplicate.
To use a current example from there: In a drawing, I have a whole lot of elements with the following style:
style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:new"
In fact, it recurs 131 times. Added to every damn element in a large drawing blows the filesize right out.

First, remove Default values where they don't need to override inherited styles;
Second, remove redundant styles, like Stroke styles when Stroke is none;
style="fill:#000000;stroke:none"
Third, have an option like in Illustrator where you can define stylesheets in the header and reference them for often-used styles, eg if long styles are needed on every element

Revision history for this message
bbyak (buliabyak) wrote : Re: [Bug 170184] Re: Less verbose markup, dont write unnecessary styles

in svn, stroke style is not written when there's no stroke

Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

There is also a problem with type atributes being kept even after converting the type objects to paths.
That seems to be an issue when importing the resulting svg into other applications such as Adobe Illustrator, making them hang.
I think the hanging illustrator part is their business, they should fix it. Anyway, if I manually edit the xml and remove the orphan style, the file is opened correctly in illustrator, so fixing that problem would improve the interoperability between these applications and that would be a benefit for inkscape.

Please let me know if this topic deserves a separate bug report or it's ok to leaving it here as a comment.

Revision history for this message
codedread (codedread) wrote :

There is a python script that handles this sort of thing now: http://launchpad.net/scour/

It would be great if someone wanted to patch this so it can be used as an Inkscape extension (or included as part of the distribution).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.