Implement a basic rewrite of redundant commands

This basic implementation can drop and rewrite some cases of "m0 0"
and "z" without triggering the issues experienced in #163.  It works
by analysing the path backwards and tracking "z" and "m" commands.

Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2018-03-11 08:22:27 +00:00
parent a2c94c96fb
commit 38274f75bc
4 changed files with 68 additions and 13 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg">
<path d="m100 100 l200 100 m0 0z" />
<path d="m100 100 v200 m0 0 100 100z" />
<path d="m100 100 v200 m0 0m0 0 2-1-2 1z" />
<path d="m100 100 v200 m0 0 3-5-5 3m0 0 2-1-2 1z" />
<path d="m100 100 v200 m0 0 3-5-5 3zm0 0 2-1-2 1z" />
</svg>

After

Width:  |  Height:  |  Size: 310 B