- (let*
- ((head (car exps))
- (rest (cdr exps))
- (arity
- (cond ((memq head '(rmoveto rlineto lineto moveto)) 2)
- ((memq head '(rcurveto curveto)) 6)
- ((eq? head 'closepath) 0)
- (else 1)))
- (args (take rest arity))
- (svg-head (assoc-get head
- '((rmoveto . m)
- (rcurveto . c)
- (curveto . C)
- (moveto . M)
- (lineto . L)
- (rlineto . l)
- (closepath . z))
- "")))
-
- (cons (format "~a~a" svg-head (number-list->point args))
- (convert-path-exps (drop rest arity))))
- '()))
-
- (entity 'path ""
- `(stroke-width . ,thick)
- '(stroke-linejoin . "round")
- '(stroke-linecap . "round")
- '(stroke . "currentColor")
- '(fill . "none")
- `(d . ,(apply string-append (convert-path-exps commands)))))
+ (let*
+ ((head (car exps))
+ (rest (cdr exps))
+ (arity
+ (cond ((memq head '(rmoveto rlineto lineto moveto)) 2)
+ ((memq head '(rcurveto curveto)) 6)
+ ((eq? head 'closepath) 0)
+ (else 1)))
+ (args (take rest arity))
+ (svg-head (assoc-get head
+ '((rmoveto . m)
+ (rcurveto . c)
+ (curveto . C)
+ (moveto . M)
+ (lineto . L)
+ (rlineto . l)
+ (closepath . z))
+ "")))
+
+ (cons (format #f "~a~a" svg-head (number-list->point args))
+ (convert-path-exps (drop rest arity))))
+ '()))
+
+ (let* ((line-cap-styles '(butt round square))
+ (line-join-styles '(miter round bevel))
+ (cap-style (if (not (memv cap line-cap-styles))
+ (begin
+ (ly:warning (_ "unknown line-cap-style: ~S")
+ (symbol->string cap))
+ 'round)
+ cap))
+ (join-style (if (not (memv join line-join-styles))
+ (begin
+ (ly:warning (_ "unknown line-join-style: ~S")
+ (symbol->string join))
+ 'round)
+ join)))
+ (entity 'path ""
+ `(stroke-width . ,thick)
+ `(stroke-linejoin . ,(symbol->string join-style))
+ `(stroke-linecap . ,(symbol->string cap-style))
+ '(stroke . "currentColor")
+ `(fill . ,(if fill? "currentColor" "none"))
+ `(d . ,(string-concatenate (convert-path-exps commands))))))