]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3880: bad number formatting in svg path output
authorDavid Kastrup <dak@gnu.org>
Sat, 5 Apr 2014 14:29:57 +0000 (16:29 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 13 Apr 2014 17:20:47 +0000 (19:20 +0200)
This uses ly:format with "~4f" format string rather than format with
"~S" for formatting point lists.  Note that "~4f" has a different
meaning in ly:format as compared to plain format.  This is consistent
with other number formatting.  Also does this for output of color.

The previous output was problematic when the number was an exact
fraction.

scm/output-svg.scm

index d00757f4e217c59d01d7e6d4f2d0fd7f864a9bea..1ddb276d31ea471211169efaa565f0980ba36041 100644 (file)
@@ -83,7 +83,7 @@
   (define (helper lst)
     (if (null? lst)
         '()
-        (cons (format #f "~S ~S" (car lst) (- (cadr lst)))
+        (cons (ly:format "~4f ~4f" (car lst) (- (cadr lst)))
               (helper (cddr lst)))))
 
   (string-join (helper lst) " "))
    '(fill . "currentColor")))
 
 (define (setcolor r g b)
-  (format #f "<g color=\"rgb(~a%, ~a%, ~a%)\">\n"
+  (ly:format "<g color=\"rgb(~4f%, ~4f%, ~4f%)\">\n"
           (* 100 r) (* 100 g) (* 100 b)))
 
 ;; rotate around given point