Convert polylines and polygons into paths
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Scour |
Confirmed
|
Low
|
Unassigned |
Bug Description
Polylines and polygons are defined in the SVG specification as being alternate forms for paths starting with an absolute move to the first point and linetos to each of the following points. In the case of polygon, a closepath is also added.
A naive reading of this feature request would just convert "polyline points=..." into "path d=M..." and "polygon points=..." into "path d=M...Z", but the real savings is had from:
* vertical and horizontal line segments;
* short line segments enabling shorter relative linetos.
Consider this polygon, from a test case in https:/
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#993300" points=
377.819,403.942 380.601,404.831 383.247,405.989 385.758,407.419 388.113,409.042 390.335,410.916 392.344,413.02 394.141,415.26 ..." />
A naive conversion would just do this:
<path fill-rule="evenodd" clip-rule="evenodd" fill="#993300" d="M370.441 402.976 371.967 403.015 374.941 403.343 377.819 403.942 380.601 404.831 383.247 405.989 385.758 407.419 388.113 409.042 390.335 410.916 392.344 413.02 394.141 415.26 ... Z" />
A real conversion would be done before paths, and thus allow the new path to be converted as well:
<path fill-rule="evenodd" clip-rule="evenodd" fill="#993300" d="m370.441 402.976 1.526.039 2.974.328 2.878.599 2.782.889 2.646 1.158 2.511 1.43 2.355 1.623 2.222 1.874 2.009 2.104 1.797 2.24 ... Z" />
which is clearly shorter.
Converting polygons and polylines into paths risks running into issues with CSS. Changing one tag to the other might completely mess up internal stylesheets and XSL stylesheets which rely on polygon and polyline, and may even conflict with declarations for paths that are not meant to be applied to the polygon and polyline tags in a document.
If there is no style tag or XSL stylesheet reference in the document, then it's completely fine.
But what should be done when there is one?