]> git.donarmstrong.com Git - lilypond.git/commitdiff
SVG backend: compact path data for bezier sandwich
authorPatrick McCarty <pnorcks@gmail.com>
Tue, 28 Jul 2009 07:27:03 +0000 (00:27 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Tue, 28 Jul 2009 07:52:36 +0000 (00:52 -0700)
scm/output-svg.scm

index a54341b0df2ed37f357f1f49da8ad8db610d1544..b64ab2a95e108fa608ffe942aca6ff992df2eec5 100644 (file)
@@ -78,7 +78,7 @@
        (apply eo (cons entity attributes-alist)) string (ec entity))))
 
 (define (offset->point o)
-  (format " ~S,~S" (car o)  (- (cdr o))))
+  (ly:format "~4f ~4f " (car o) (- (cdr o))))
 
 (define (number-list->point lst)
   (define (helper lst)
   (let* ((c0 (car (list-tail lst 3)))
         (c123 (list-head lst 3)))
     (string-append
-     (if (not close) "M " "L ")
-     (offset->point c0)
-     "C " (apply string-append (map offset->point c123))
-     (if (not close) "" (string-append
-                        "L " (offset->point close))))))
+      (if (not close) "M" "L")
+      (offset->point c0)
+      "C" (apply string-append (map offset->point c123))
+      (if (not close) "" "z"))))
 
 (define (sqr x)
   (* x x))
 
 (define (bezier-sandwich lst thick)
   (let* ((first (list-tail lst 4))
-        (first-c0 (car (list-tail first 3)))
         (second (list-head lst 4)))
     (entity 'path ""
            '(stroke-linejoin . "round")
            '(fill . "currentColor")
            `(stroke-width . ,thick)
            `(d . ,(string-append (svg-bezier first #f)
-                                 (svg-bezier second first-c0)))
+                                 (svg-bezier second #t)))
            )))
 
 (define (char font i)