From cc53bc17ad36cece69e2687cc935143edb0ccb79 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Tue, 28 Jul 2009 13:47:09 -0700 Subject: [PATCH] SVG backend: cleanup 'path expression --- scm/output-svg.scm | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/scm/output-svg.scm b/scm/output-svg.scm index b8ca001c71..f9222462dd 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -84,7 +84,7 @@ (define (helper lst) (if (null? lst) '() - (cons (format "~S,~S" (car lst) (cadr lst)) + (cons (format "~S ~S" (car lst) (- (cadr lst))) (helper (cddr lst))))) (string-join (helper lst) " ")) @@ -409,26 +409,24 @@ (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) - ) + ((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)))) '())) @@ -438,7 +436,7 @@ '(stroke-linecap . "round") '(stroke . "currentColor") '(fill . "none") - `(d . ,(string-join (convert-path-exps commands) " ")))) + `(d . ,(apply string-append (convert-path-exps commands))))) (define (placebox x y expr) (if (string-null? expr) -- 2.39.2