Comment 3 for bug 171983

Revision history for this message
bbyak (buliabyak) wrote : Re: [Bug 171983] Re: Reduce SVG file size by removing unnecessary attributes

Halley:

thanks for the patch, but I think you're working in a wrong place. The
logic of writing/skipping style properties is in style.cpp, namely
sp_style_write_string and sp_style_write_difference. As you will
notice, certain props (fill/stroke) are already skipped based on some
conditions. What you need to do is just extend this logic and cover
more properties and contexts. However, be VERY careful with this, and
start by carefully reading the SVG spec for each property, to find out
when and when not it is redundant. For example, some property may look
redundant in most cases but it may take effect when a different value
is inherited from its parent. Some props are inherited, some not, they
have different default values, etc. All this needs to be taken into
account before you decide to skip some property, and you need to write
a "proof" of skippability for each case in comments. When in doubt,
compare to Batik rendering. Thanks, and good luck with Inkscape
hacking! :)