Bug 406634 - Isolated 'use' elements in a Vector Library .svg file should be ignored
Summary: Isolated 'use' elements in a Vector Library .svg file should be ignored
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Dockers (show other bugs)
Version: unspecified
Platform: Debian stable Linux
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-17 16:57 UTC by Ahab Greybeard
Modified: 2019-10-03 12:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
None duplicated version of the default ballon symbols vector library (8.94 KB, image/svg+xml)
2019-04-17 16:57 UTC, Ahab Greybeard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahab Greybeard 2019-04-17 16:57:09 UTC
Created attachment 119465 [details]
None duplicated version of the default ballon symbols vector library

SUMMARY
The krita default installation has vector library files (.svg files) that display duplicates in the Vector Library docker. This is common to all the default vector library items.

This seems to be caused by the 'use' elements being interpreted as elements to be displayed in the Vector Libray docker. Only the 'symbol' elements are needed. The 'use' elements are a cosmetic/document leftover from the initial production of the symbol set in Inkscape (or whatever was used to make the library file) and correspond to the document contents before they were added to the symbol library.

The 'use' elements have a minor benefit in that they are displayed in a desktop or file manager file icon so keeping them may be a good idea but they are not needed for use in a krita vector library file and should be ignored.

It may be possible that a 'symbol' element will contain a 'use' element in order to incorporate one symbol as part of another symbol but that would not be an isolated 'use' element.

The attached file "BalloonSymbols-A.svg" was made by text editing the krita default "BalloonSymbols.svg" file to remove all isolated 'use' elements. (The same results can be obtained by deleting a document vector object after it has been added to the symbol list in Inkscape.) This file can be placed into the user's --/krita/symbols folder to give a vector library with no duplicates. It's provided as an illustrative example.

STEPS TO REPRODUCE
Open the Vector Library docker and select any of the default libray collections to view them. 

SOFTWARE/OS VERSIONS
This is on all appimages

ADDITIONAL INFORMATION
A workaround is to only use vector library files without any 'use' elements in them. (Example file attached.)
Comment 1 wolthera 2019-09-21 16:25:43 UTC
yes. confirmed.
Comment 2 wolthera 2019-09-26 13:22:32 UTC
Git commit 205024f84371267f3bb0f7adf808e67460268e7e by Wolthera van Hövell tot Westerflier.
Committed on 26/09/2019 at 13:21.
Pushed by woltherav into branch 'master'.

Prevent duplicate svg symbols in the vector library docker.

This was caused by the fact that right now, whenever svg use elements are used,
instead of loading it into something or the other, it just reparses the
definition the use is referring to. This is a robust fallback, but also led to
duplicate entries in the vector library docker.

Now the parser uses a somewhat similar system as the one in use for other def
citizens like the gradients, clip paths and masks, filters and markers, and will
not allow duplicate ID entries anymore.

This is also consistent with the SVG spec.

M  +2    -3    libs/flake/svg/SvgParser.cpp
M  +1    -1    libs/flake/svg/SvgParser.h

https://invent.kde.org/kde/krita/commit/205024f84371267f3bb0f7adf808e67460268e7e
Comment 3 Halla Rempt 2019-10-03 12:29:12 UTC
Git commit 5f20cbd965866f2f32af0fc52d1e40f7da9ae28e by Boudewijn Rempt, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 03/10/2019 at 12:29.
Pushed by rempt into branch 'krita/4.2'.

Prevent duplicate svg symbols in the vector library docker.

This was caused by the fact that right now, whenever svg use elements are used,
instead of loading it into something or the other, it just reparses the
definition the use is referring to. This is a robust fallback, but also led to
duplicate entries in the vector library docker.

Now the parser uses a somewhat similar system as the one in use for other def
citizens like the gradients, clip paths and masks, filters and markers, and will
not allow duplicate ID entries anymore.

This is also consistent with the SVG spec.

M  +2    -3    libs/flake/svg/SvgParser.cpp
M  +1    -1    libs/flake/svg/SvgParser.h

https://invent.kde.org/kde/krita/commit/5f20cbd965866f2f32af0fc52d1e40f7da9ae28e