From f0fc8388f6baa9b9e425e64bcf56dba615ece2c8 Mon Sep 17 00:00:00 2001 From: Joe Westcott Date: Mon, 4 Feb 2019 14:21:12 +0000 Subject: SVG closepath support --- svgbasic.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'svgbasic.go') diff --git a/svgbasic.go b/svgbasic.go index cb8e91e..cc35073 100644 --- a/svgbasic.go +++ b/svgbasic.go @@ -129,6 +129,8 @@ func pathParse(pathStr string) (segs []SVGBasicSegmentType, err error) { setup(6) case 'L', 'l': // Absolute/relative lineto: x, y setup(2) + case 'Z', 'z': // closepath instruction (takes no arguments) + break default: err = fmt.Errorf("expecting SVG path command at position %d, got %s", j, str) } @@ -165,8 +167,8 @@ type SVGBasicType struct { // descriptor. Only a small subset of the SVG standard, in particular the path // information generated by jSignature, is supported. The returned path data // includes only the commands 'M' (absolute moveto: x, y), 'L' (absolute -// lineto: x, y), and 'C' (absolute cubic Bézier curve: cx0, cy0, cx1, cy1, -// x1,y1). +// lineto: x, y), 'C' (absolute cubic Bézier curve: cx0, cy0, cx1, cy1, +// x1,y1) and 'Z' (closepath). func SVGBasicParse(buf []byte) (sig SVGBasicType, err error) { type pathType struct { D string `xml:"d,attr"` -- cgit v1.2.1-24-ge1ad