summaryrefslogtreecommitdiff
path: root/svgbasic.go
diff options
context:
space:
mode:
authorJoe Westcott <joewestcott@users.noreply.github.com>2019-02-04 14:21:12 +0000
committerJoe Westcott <joewestcott@users.noreply.github.com>2019-02-04 14:21:12 +0000
commitf0fc8388f6baa9b9e425e64bcf56dba615ece2c8 (patch)
tree84ad731a86c53571bf507009ad9437a5aab00d14 /svgbasic.go
parent82f8581de0da69bda7696183c7e9d890be24fa63 (diff)
SVG closepath support
Diffstat (limited to 'svgbasic.go')
-rw-r--r--svgbasic.go6
1 files changed, 4 insertions, 2 deletions
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"`