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.
(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