Detect and create <symbol> elements from repeated shapes

Registered by Adrian Jones

I think this would be quite tricky to implement, but it could potentially create drammatically smaller files in some cases. It would need to detect identical paths/fills and push these into a <symbol> element and then add the appropriate <use>'s.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

I suspect any implementation of this feature might be more frustrating than not, since it would definitely change the underlying semantics of the document. - codedread

If anyone wants an example of what the transform can look like in practice, I did one manually here: https://github.com/johan/svg-cleanups/commit/ca516606b1b6dad14108457cb50735a654337b69

On this file, the space savings were ~20% of the file size – and the "I":s were smaller without the <use> tags. It's possible the #t ones would benefit size wise from staying duplicated too; a <use> tag is a little verbose, so to be really sure it is best to compare total footprint of each <use> reference plus the template, vs the original size.

The use of only the X coordinate in my transform attributes is an "extra credit" type optimization that happened to be useful in this particular case, where they all had the same Y coordinate – the typical way to go would be to make the shapes start with a "m0 0" in the <defs> and then place them in both X/Y in the <use> tag. (Strictly speaking, the <use xlink:href="#t"> tags I made would most likely not have been produced by automation, as there were very minute differences between the three T:s in the image.) - ecmanaut

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.