diff options
-rw-r--r-- | svgbasic.go | 6 | ||||
-rw-r--r-- | svgwrite.go | 2 |
2 files changed, 6 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"` diff --git a/svgwrite.go b/svgwrite.go index 04f6cb3..7e455fb 100644 --- a/svgwrite.go +++ b/svgwrite.go @@ -50,6 +50,8 @@ func (f *Fpdf) SVGBasicWrite(sb *SVGBasicType, scale float64) { newX, newY = val(4) f.CurveCubic(x, y, cx0, cy0, newX, newY, cx1, cy1, "D") x, y = newX, newY + case 'Z': + f.Line(x, y, originX, originY) default: f.SetErrorf("Unexpected path command '%c'", seg.Cmd) } |