]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-ps.scm (path): reorder arguments.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 19 Jul 2006 13:05:33 +0000 (13:05 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 19 Jul 2006 13:05:33 +0000 (13:05 +0000)
* scm/output-svg.scm (path): support for path primitive.

ChangeLog
scm/output-ps.scm
scm/output-svg.scm

index e4bc54887b93e94266921cea1007d71129f8a46e..6151491b8e851f2e76b044dcc6d55bb4bf9bc216 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-07-19  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * scm/output-lib.scm (fall::print): use new order.
+
+       * scm/output-ps.scm (path): reorder arguments.
+
+       * scm/output-svg.scm (path): support for path primitive.
+
        * input/regression/bend-after.ly: new file.
 
        * Documentation/user/GNUmakefile ($(outdir)/%.pdf): foolproof
index 6fe28dc446c7bbfa8db3f004c5394ab21288007b..94d53f71defbefa0a9f255da433f795ce13b8b70 100644 (file)
 
 
 (define (path thickness exps)
-  (define  (path-exps->ps-path-exps exps)
+  (define (convert-path-exps exps)
     (if (pair? exps)
        (let*
            ((head (car exps))
          (cons (format "~a ~a "
                        (string-join (map (lambda (x) (format "~a " x)) args) " ")
                        head)
-               (path-exps->ps-path-exps (drop rest arity))))
+               (convert-path-exps (drop rest arity))))
        '()))
     
     
   (format
    "1 setlinecap ~a setlinewidth\n~a stroke"
    thickness
-   (string-join (path-exps->ps-path-exps exps) " ")))
+   (string-join (convert-path-exps exps) " ")))
   
index cabf8f7da09d5ce7606fa6d763fe1a49036fe926..3ed5e22c148d5dc152839ae2972f088257b2d4fa 100644 (file)
@@ -24,6 +24,7 @@
  (guile)
  (ice-9 regex)
  (lily)
+ (srfi srfi-1)
  (srfi srfi-13))
 
 
 (define (offset->point o)
   (format #f " ~S,~S" (car o)  (- (cdr o))))
 
+(define (number-list->point lst)
+  (define (helper lst)
+    (if (null? lst)
+       '()
+       (cons (format "~S,~S" (car lst) (cadr lst))
+             (helper (cddr lst)))))
+
+  (string-join (helper lst) " "))  
+
+
 (define (svg-bezier lst close)
   (let* ((c0 (car (list-tail lst 3)))
         (c123 (list-head lst 3)))
            )))
 
 (define (path thick commands)
-  (define (ps-path-entries->svg-path entries)
-    
+  (define (convert-path-exps exps)
+    (if (pair? exps)
+       (let*
+           ((head (car exps))
+            (rest (cdr exps))
+            (arity 
+             (cond
+              ((memq head '(rmoveto rlineto lineto moveto)) 2)
+              ((memq head '(rcurveto curveto)) 6)
+              (else 1)))
+            (args (take rest arity))
+            (svg-head (assoc-get head '((rmoveto . m)
+                                        (rcurveto . c)
+                                        (curveto . C)
+                                        (moveto . M)
+                                        (lineto . L)
+                                        (rlineto . l))
+                                 ""))
+            )
+
+         (cons (format "~a~a "
+                       svg-head (number-list->point args)
+                       )
+               (convert-path-exps (drop rest arity))))
+       '()))
   
   (entity 'path ""
          `(stroke-width . ,thick)
          '(stroke-linejoin . "round")
          '(stroke-linecap . "round")
          '(stroke . "currentColor")
-         '(fill . "currentColor")
-           
+         '(fill . "none")
+         `(d . ,(string-join (convert-path-exps commands) " "))))
   
-  ))
-
-
 (define (char font i)
   (dispatch
    `(fontify ,font ,(entity 'tspan (char->entity (integer->char i))))))