]> git.donarmstrong.com Git - lilypond.git/commitdiff
SVG backend: add "repeat-slash" stencil expression
authorPatrick McCarty <pnorcks@gmail.com>
Wed, 29 Jul 2009 03:24:05 +0000 (20:24 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Wed, 29 Jul 2009 03:24:05 +0000 (20:24 -0700)
Adapted from the PostScript implementation for consistency

scm/output-svg.scm

index f9222462dd0da5d3d4fa057b6257934d7d0fa7df..6076bdaa72ac0b981d986664c6671d4951295a40 100644 (file)
    `(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)
   "</g>\n")