Hi,
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>, <path>, etc.) it checks:
1. That all attributes are valid.[1]
2. That properties are appropriate.[2]
3. That properties are useful.[3]
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
1. Print out warnings to the console (if running Inkscape from the command line).
2. Delete the invalid or not useful items.
In the dialog, you can choose when Inkscape should test the SVG:
1. When reading files. (If this option is enabled at start-up, files Inkscape uses internally like icons.svg will also be checked.)
2. When editing files. (Mostly useful for debugging Inkscape.)
3. When writing files.
This code has been test on a variety of SVG files but it will need much broader testing. The default preferences are set to do nothing so as to avoid the risk of damaging files. Please take your favorite SVG files and compare the visual output when the "Remove" and "Writing" boxes are checked in the Inkscape Preferences dialog. Also, compiling the code under Windows and OSX needs to be checked.
Tav
[1] Only elements in the SVG name space are tested.
[2] The SVG specification explicitly allows styling properties such as 'font-family' on most SVG elements (e.g. <rect>) but there a many cases where they are of no use.
[3] A property is useful if it changes an inherited or default value.
On Tue, 2011-11-29 at 12:38 +0100, Tavmjong Bah wrote:
This code has been test on a variety of SVG files but it will need much broader testing.
Do we have automatic tests? I'd be nice to be able to fill a directory with svg files and run them over with the setting switched off, export a png, then with it switched on, then compare the outputs. any differences in pixels == problem.
Martin,
On 29/11/11 12:38, Tavmjong Bah wrote:
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>, <path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
Testing r10753 on Mac OS X 10.5.8 (i386) (not packaged as osxapp) built with Apple's GCC 4.2.1 deps: Glib 2.28.8, Gtk+ 2.24.4, Perl v5.12.3
This part:
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
doesn't work independently for me: if I check to print warnings e.g. for not useful properties on writing, attributes in filter definitions considered as invalid are removed nevertheless [1]. Same when checking for not useful properties on reading: the 'invalid' attributes are unexpectedly removed from the filter definitions on load (e.g. when reverting the document after changing the preferences) [2].
~suv
[1] in this process modifying (custom) filter effects by removing the 'in' attribute for feMergeNode (declared as invalid), and thus changing files which had been saved as a copy (or loaded) to see the warnings only (for testing).
The printed warning when explicitly checking for invalid attributes:
WARNING **: <svg:feMergeNode id="feMergeNode3158">: Invalid attribute: "in" found.
[2] unrelated to the changes in r10753, but annoying when testing: even when using 'Save a copy as...' 'Inkscape SVG' to keep the original file unchanged in the current document window, the content of the current document window appears to be replaced with the content of the saved copy (with e.g. "broken" custom filter effects).
Attached: test file with custom filter effect (WIP) in use for a custom Inkscape icons.svg file
On Tue, 2011-11-29 at 15:59 +0100, ~suv wrote:
On 29/11/11 12:38, Tavmjong Bah wrote:
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>, <path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
Testing r10753 on Mac OS X 10.5.8 (i386) (not packaged as osxapp) built with Apple's GCC 4.2.1 deps: Glib 2.28.8, Gtk+ 2.24.4, Perl v5.12.3
This part:
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
doesn't work independently for me: if I check to print warnings e.g. for not useful properties on writing, attributes in filter definitions considered as invalid are removed nevertheless [1]. Same when checking for not useful properties on reading: the 'invalid' attributes are unexpectedly removed from the filter definitions on load (e.g. when reverting the document after changing the preferences) [2].
Just checked in fixes. The Attributes appendix in the SVG spec left out "feMergeNode" from the list of elements using "in". The unrequested deletion was a bug. The same bug probably also caused the problem with "Save a copy as..."
Tav
~suv
[1] in this process modifying (custom) filter effects by removing the 'in' attribute for feMergeNode (declared as invalid), and thus changing files which had been saved as a copy (or loaded) to see the warnings only (for testing).
The printed warning when explicitly checking for invalid attributes:
WARNING **: <svg:feMergeNode id="feMergeNode3158">: Invalid attribute: "in" found.
[2] unrelated to the changes in r10753, but annoying when testing: even when using 'Save a copy as...' 'Inkscape SVG' to keep the original file unchanged in the current document window, the content of the current document window appears to be replaced with the content of the saved copy (with e.g. "broken" custom filter effects).
Attached: test file with custom filter effect (WIP) in use for a custom Inkscape icons.svg file
On 29/11/11 17:00, Tavmjong Bah wrote:
On Tue, 2011-11-29 at 15:59 +0100, ~suv wrote:
On 29/11/11 12:38, Tavmjong Bah wrote:
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>, <path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
Testing r10753 on Mac OS X 10.5.8 (i386) (not packaged as osxapp) built with Apple's GCC 4.2.1 deps: Glib 2.28.8, Gtk+ 2.24.4, Perl v5.12.3
This part:
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
doesn't work independently for me: if I check to print warnings e.g. for not useful properties on writing, attributes in filter definitions considered as invalid are removed nevertheless [1]. Same when checking for not useful properties on reading: the 'invalid' attributes are unexpectedly removed from the filter definitions on load (e.g. when reverting the document after changing the preferences) [2].
Just checked in fixes. The Attributes appendix in the SVG spec left out "feMergeNode" from the list of elements using "in". The unrequested deletion was a bug. The same bug probably also caused the problem with "Save a copy as..."
Thanks for the quick update - r10754 no longer deletes when printing warnings e.g. for not useful properties, and also considers "in" a valid attribute of feMergeNode.
[2] unrelated to the changes in r10753, but annoying when testing: even when using 'Save a copy as...' 'Inkscape SVG' to keep the original file unchanged in the current document window, the content of the current document window appears to be replaced with the content of the saved copy (with e.g. "broken" custom filter effects).
The issue with 'Save a Copy as...' persists [1]. When saving a copy as 'Inkscape SVG' with 'remove invalid attributes' on 'writing', the content of the current window is modified too: e.g. using the test file attached earlier, the "in" attributes of the three feFlood filter primitives are gone when checking the filter definition in the XML editor (I'd expect that change to only occur in the saved copy). The otherwise unchanged document is not dirtied (no entry in the undo history either) and can be closed without prompting a close|cancel|save message.
~suv
[1] I had noticed a similar issue earlier this week when testing an issue reported on irc about the file format 'Plain SVG' removing a valid attribute of clip-paths and masks.
Download http://www.w3.org/Graphics/SVG/Test/20110816/svg/masking-path-02-b.svg from the test suite, open it in Inkscape trunk (default prefs) and save a copy as 'Plain SVG'. Now open the original file and the just created 'Plain SVG' version in new windows and compare the content of all three windows: 'clipPathUnits="objectBoundingBox"' is removed unexpectedly when saving as 'Plain SVG'. The content in the first window after saving a copy as 'Plain SVG' still has that attribute (checked in the XML editor), but looks otherwise different.
Saving a copy as 'Inkscape SVG' does not remove the attribute nor visibly change the content of the current window in this case.
(the same happens for 'maskContentUnits="objectBoundingBox"', which was the original question asked on irc about 'Plain SVG')
I can't build R10754 on windows. There is a problem. I try to figure out what's wrong.
UweSch
Am 29.11.2011 19:04, schrieb ~suv:
On 29/11/11 17:00, Tavmjong Bah wrote:
On Tue, 2011-11-29 at 15:59 +0100, ~suv wrote:
On 29/11/11 12:38, Tavmjong Bah wrote:
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>,<path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
Testing r10753 on Mac OS X 10.5.8 (i386) (not packaged as osxapp) built with Apple's GCC 4.2.1 deps: Glib 2.28.8, Gtk+ 2.24.4, Perl v5.12.3
This part:
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
doesn't work independently for me: if I check to print warnings e.g. for not useful properties on writing, attributes in filter definitions considered as invalid are removed nevertheless [1]. Same when checking for not useful properties on reading: the 'invalid' attributes are unexpectedly removed from the filter definitions on load (e.g. when reverting the document after changing the preferences) [2].
Just checked in fixes. The Attributes appendix in the SVG spec left out "feMergeNode" from the list of elements using "in". The unrequested deletion was a bug. The same bug probably also caused the problem with "Save a copy as..."
Thanks for the quick update - r10754 no longer deletes when printing warnings e.g. for not useful properties, and also considers "in" a valid attribute of feMergeNode.
[2] unrelated to the changes in r10753, but annoying when testing: even when using 'Save a copy as...' 'Inkscape SVG' to keep the original file unchanged in the current document window, the content of the current document window appears to be replaced with the content of the saved copy (with e.g. "broken" custom filter effects).
The issue with 'Save a Copy as...' persists [1]. When saving a copy as 'Inkscape SVG' with 'remove invalid attributes' on 'writing', the content of the current window is modified too: e.g. using the test file attached earlier, the "in" attributes of the three feFlood filter primitives are gone when checking the filter definition in the XML editor (I'd expect that change to only occur in the saved copy). The otherwise unchanged document is not dirtied (no entry in the undo history either) and can be closed without prompting a close|cancel|save message.
~suv
[1] I had noticed a similar issue earlier this week when testing an issue reported on irc about the file format 'Plain SVG' removing a valid attribute of clip-paths and masks.
Download http://www.w3.org/Graphics/SVG/Test/20110816/svg/masking-path-02-b.svg from the test suite, open it in Inkscape trunk (default prefs) and save a copy as 'Plain SVG'. Now open the original file and the just created 'Plain SVG' version in new windows and compare the content of all three windows: 'clipPathUnits="objectBoundingBox"' is removed unexpectedly when saving as 'Plain SVG'. The content in the first window after saving a copy as 'Plain SVG' still has that attribute (checked in the XML editor), but looks otherwise different.
Saving a copy as 'Inkscape SVG' does not remove the attribute nor visibly change the content of the current window in this case.
(the same happens for 'maskContentUnits="objectBoundingBox"', which was the original question asked on irc about 'Plain SVG')
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On Tuesday, November 29, 2011, 5:00:38 PM, Tavmjong wrote:
TB> Just checked in fixes. The Attributes appendix in the SVG spec left out TB> "feMergeNode" from the list of elements using "in". The unrequested TB> deletion was a bug. The same bug probably also caused the problem with TB> "Save a copy as..."
Tav, please file a bug report on the appendix (I assume this was in SVG 1.1 second edition? Odd if so, I thought the table was autogenerated from the spec.)
On Tue, 2011-11-29 at 21:51 +0100, Chris Lilley wrote:
On Tuesday, November 29, 2011, 5:00:38 PM, Tavmjong wrote:
TB> Just checked in fixes. The Attributes appendix in the SVG spec left out TB> "feMergeNode" from the list of elements using "in". The unrequested TB> deletion was a bug. The same bug probably also caused the problem with TB> "Save a copy as..."
Tav, please file a bug report on the appendix (I assume this was in SVG 1.1 second edition? Odd if so, I thought the table was autogenerated from the spec.)
Yes, it is SVG 1.1 Second Edition and yes, the appendix is auto-generated from the file definitions.xml which does list 'in' as an attribute for 'feMergeNode'. It must be a bug in the XSL. I see that 'externalResourcesRequired' is missing 'feImage'. When I get a chance I will write a separate script to check all attributes.
Tav
haven't yet had a chance to try it, but just have a quick question: will this type of validity checking be applied, or could it be applied, to other output processes such as saving as pdf or emf?
Alvin
Hi,
on windows vista I get the two following error messages while building R10754:
Make error line 289: problem compiling: src/attribute-rel-css.cpp: In constructor 'SPAttributeRelCSS uteRelCSS()': src/attribute-rel-css.cpp:111:28: error: 'WIN32_DATADIR' was not declared in this scope src/attribute-rel-css.cpp:111:28: error: expected ',' or ';' before string constant src/attribute-rel-css.cpp:122:16: error: expected ';' before string constant
Make error line 289: problem compiling: src/attribute-rel-svg.cpp: In constructor 'SPAttributeRelSVG uteRelSVG()': src/attribute-rel-svg.cpp:72:28: error: 'WIN32_DATADIR' was not declared in this scope src/attribute-rel-svg.cpp:72:28: error: expected ',' or ';' before string constant
Can someone fix it?
Sincerely, UweSch
Am 29.11.2011 12:38, schrieb Tavmjong Bah:
Hi,
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>,<path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
In the dialog, you can choose when Inkscape should test the SVG:
- When reading files. (If this option is enabled at start-up,
files Inkscape uses internally like icons.svg will also be checked.)
When editing files. (Mostly useful for debugging Inkscape.)
When writing files.
This code has been test on a variety of SVG files but it will need much broader testing. The default preferences are set to do nothing so as to avoid the risk of damaging files. Please take your favorite SVG files and compare the visual output when the "Remove" and "Writing" boxes are checked in the Inkscape Preferences dialog. Also, compiling the code under Windows and OSX needs to be checked.
Tav
[1] Only elements in the SVG name space are tested.
[2] The SVG specification explicitly allows styling properties such as 'font-family' on most SVG elements (e.g.<rect>) but there a many cases where they are of no use.
[3] A property is useful if it changes an inherited or default value.
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Fixed in rev. 10755. Ciao, Johan
On 29-11-2011 21:59, Uwe Schöler wrote:
Hi,
on windows vista I get the two following error messages while building R10754:
Make error line 289: problem compiling: src/attribute-rel-css.cpp: In constructor 'SPAttributeRelCSS uteRelCSS()': src/attribute-rel-css.cpp:111:28: error: 'WIN32_DATADIR' was not declared in this scope src/attribute-rel-css.cpp:111:28: error: expected ',' or ';' before string constant src/attribute-rel-css.cpp:122:16: error: expected ';' before string constant
Make error line 289: problem compiling: src/attribute-rel-svg.cpp: In constructor 'SPAttributeRelSVG uteRelSVG()': src/attribute-rel-svg.cpp:72:28: error: 'WIN32_DATADIR' was not declared in this scope src/attribute-rel-svg.cpp:72:28: error: expected ',' or ';' before string constant
Can someone fix it?
Sincerely, UweSch
Am 29.11.2011 12:38, schrieb Tavmjong Bah:
Hi,
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>,<path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
In the dialog, you can choose when Inkscape should test the SVG:
- When reading files. (If this option is enabled at start-up,
files Inkscape uses internally like icons.svg will also be checked.)
When editing files. (Mostly useful for debugging Inkscape.)
When writing files.
This code has been test on a variety of SVG files but it will need much broader testing. The default preferences are set to do nothing so as to avoid the risk of damaging files. Please take your favorite SVG files and compare the visual output when the "Remove" and "Writing" boxes are checked in the Inkscape Preferences dialog. Also, compiling the code under Windows and OSX needs to be checked.
Tav
[1] Only elements in the SVG name space are tested.
[2] The SVG specification explicitly allows styling properties such as 'font-family' on most SVG elements (e.g.<rect>) but there a many cases where they are of no use.
[3] A property is useful if it changes an inherited or default value.
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Hi Johan,
you fixed it ;) I could build 10755 without errors.
Thx,
UweSch
Am 29.11.2011 22:50, schrieb Johan Engelen:
Fixed in rev. 10755. Ciao, Johan
On 29-11-2011 21:59, Uwe Schöler wrote:
Hi,
on windows vista I get the two following error messages while building R10754:
Make error line 289: problem compiling: src/attribute-rel-css.cpp: In constructor 'SPAttributeRelCSS uteRelCSS()': src/attribute-rel-css.cpp:111:28: error: 'WIN32_DATADIR' was not declared in this scope src/attribute-rel-css.cpp:111:28: error: expected ',' or ';' before string constant src/attribute-rel-css.cpp:122:16: error: expected ';' before string constant
Make error line 289: problem compiling: src/attribute-rel-svg.cpp: In constructor 'SPAttributeRelSVG uteRelSVG()': src/attribute-rel-svg.cpp:72:28: error: 'WIN32_DATADIR' was not declared in this scope src/attribute-rel-svg.cpp:72:28: error: expected ',' or ';' before string constant
Can someone fix it?
Sincerely, UweSch
Am 29.11.2011 12:38, schrieb Tavmjong Bah:
Hi,
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output. Abhishek wrote the core routines to which I added a variety of utility functions. This code can result in cleaner and smaller SVG. It does the following things:
For a given element (<rect>,<path>, etc.) it checks:
That all attributes are valid.[1]
That properties are appropriate.[2]
That properties are useful.[3]
What Inkscape does when it finds a problem is controlled by settings under the "SVG output" section of the Inkscape Preferences dialog. For each of the above cases, you can independently:
- Print out warnings to the console (if running Inkscape from the
command line).
- Delete the invalid or not useful items.
In the dialog, you can choose when Inkscape should test the SVG:
- When reading files. (If this option is enabled at start-up,
files Inkscape uses internally like icons.svg will also be checked.)
When editing files. (Mostly useful for debugging Inkscape.)
When writing files.
This code has been test on a variety of SVG files but it will need much broader testing. The default preferences are set to do nothing so as to avoid the risk of damaging files. Please take your favorite SVG files and compare the visual output when the "Remove" and "Writing" boxes are checked in the Inkscape Preferences dialog. Also, compiling the code under Windows and OSX needs to be checked.
Tav
[1] Only elements in the SVG name space are tested.
[2] The SVG specification explicitly allows styling properties such as 'font-family' on most SVG elements (e.g.<rect>) but there a many cases where they are of no use.
[3] A property is useful if it changes an inherited or default value.
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On 29-11-2011 12:38, Tavmjong Bah wrote:
Hi,
I have just checked into trunk some of the fruits of Abhishek's GSOC project to improve Inkscape's SVG output.
Hi Tav,
(just fixed the Windows build error, no worries)
Could you spend some time adding the standard copyright text to the new code files?
Cheers, Johan
participants (7)
-
Alvin Penner
-
Chris Lilley
-
Johan Engelen
-
Martin Owens
-
Tavmjong Bah
-
Uwe Schöler
-
~suv