]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-svg.scm
Revert "Clean up declarations-init.ly, paper-defaults-init.ly."
[lilypond.git] / scm / output-svg.scm
index 40aafb420f18d0348eada77f15a0a2b8e10781b0..9b1b250f77857a631b525bd90fa282b796b6e178 100644 (file)
                            (- (* start-radius (sin new-start-angle))))
                 "")))))))
 
-(define (connected-shape pointlist thick x-scale y-scale connect fill)
-  (entity
-    'path ""
-    `(fill . ,(if fill "currentColor" "none"))
-    `(stroke . "currentColor")
-    `(stroke-width . ,thick)
-    '(stroke-linejoin . "round")
-    '(stroke-linecap . "round")
-    (cons
-      'd
-      (ly:format
-        "M0 0~a ~a"
-        (string-concatenate
-          (map (lambda (x)
-                 (apply
-                   (if (eq? (length x) 6)
-                       (lambda (x1 x2 x3 x4 x5 x6)
-                         (ly:format "C~4f ~4f ~4f ~4f ~4f ~4f"
-                                    (* x1 x-scale)
-                                    (- (* x2 y-scale))
-                                    (* x3 x-scale)
-                                    (- (* x4 y-scale))
-                                    (* x5 x-scale)
-                                    (- (* x6 y-scale))))
-                       (lambda (x1 x2)
-                         (ly:format "L~4f ~4f"
-                                    (* x-scale x1)
-                                    (- (* y-scale x2)))))
-                   x))
-               pointlist))
-        (if connect "z " "")))))
-
 (define (embedded-svg string)
   string)
 
                (convert-path-exps (drop rest arity))))
        '()))
 
-  (entity 'path ""
-         `(stroke-width . ,thick)
-         `(stroke-linejoin . ,(symbol->string join))
-         `(stroke-linecap . ,(symbol->string cap))
-         '(stroke . "currentColor")
-         `(fill . ,(if fill? "currentColor" "none"))
-         `(d . ,(apply string-append (convert-path-exps commands)))))
+  (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 . ,(apply string-append (convert-path-exps commands))))))
 
 (define (placebox x y expr)
   (if (string-null? expr)
 (define (resetrotation ang x y)
   "</g>\n")
 
+(define (resetscale)
+  "</g>\n")
+
 (define (round-filled-box breapth width depth height blot-diameter)
   (entity
     'rect ""
   (ly:format "<g transform=\"rotate(~4f, ~4f, ~4f)\">\n"
             (- ang) x (- y)))
 
+(define (setscale x y)
+  (ly:format "<g transform=\"scale(~4f, ~4f)\">\n"
+            x y))
+
 (define (text font string)
   (dispatch `(fontify ,font ,(entity 'tspan (string->entities string)))))