Search code examples
svginkscape

SVG path line instruction with only one parameter


Inkscape is producing this as a path for a shape in SVG path:

M120.6,28.1l10.6,0.1l20.1,34l-31.7,23.3l19.6,17.8l-0.4,16.2l-47.8-0.2L80.8,95.6v-7.5l17-24.5l12.5-6.8V36.2L120.6,28.1z

Some l instructions have subtractions. Does that then mean that they have to be subtracted and the resulting value is the coordinate?

Also, the last L value only has one coordinate. Does that then only specify x coord changing, as I guess the v means only y is changing?

I'm able to feed this path back into inkscape and get the same shape in return.


Solution

  • The parser for paths consumes one character at a time. When parsing a number it parses characters till it gets one that can't be part of the number it's parsing. So a negative sign at the end of a number must be the start of a new (negative) number.