From 7ef4ccd3629c2068c8ad70ccd0ea2b2bcd4a6cca Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Tue, 28 Jul 2009 20:24:05 -0700 Subject: [PATCH] SVG backend: add "repeat-slash" stencil expression Adapted from the PostScript implementation for consistency --- scm/output-svg.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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") -- 2.39.2