From: Patrick McCarty Date: Wed, 29 Jul 2009 03:24:05 +0000 (-0700) Subject: SVG backend: add "repeat-slash" stencil expression X-Git-Tag: release/2.13.4-1~262 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7ef4ccd3629c2068c8ad70ccd0ea2b2bcd4a6cca;p=lilypond.git SVG backend: add "repeat-slash" stencil expression Adapted from the PostScript implementation for consistency --- diff --git a/scm/output-svg.scm b/scm/output-svg.scm index f9222462dd..6076bdaa72 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -469,8 +469,18 @@ `(fill . ,(if is-filled "currentColor" "none")) '(stroke . "currentColor") `(points . ,(string-join - (map offset->point (ly:list->offsets '() coords)))) - )) + (map offset->point (ly:list->offsets '() coords)))))) + +(define (repeat-slash width slope thickness) + (define (euclidean-length x y) + (sqrt (+ (* x x) (* y y)))) + (let* ((x-width (euclidean-length thickness (/ thickness slope))) + (height (* width slope))) + (entity + 'path "" + '(fill . "currentColor") + `(d . ,(ly:format "M0 0l~4f 0 ~4f ~4f ~4f 0z" + x-width width (- height) (- x-width)))))) (define (resetcolor) "\n")