bad number formatting in svg path output

2014-03-06 Thread lpietsch
There may be a bug in scm/output-svg.scm, in the function that processes
stencil expressions created with "(ly:create-stencil '(path ...))". If a
coordinate in the path expression happens to be the result of a Scheme
computation that is a fractional rational number, it will be written into
the SVG output literally as a Scheme fraction (e.g. "3/2"). SVG does not
understand this format.

Test snippet:

\once \override NoteHead.stencil = 
   #(ly:make-stencil `(path 0.2
'(moveto 0 0
  rlineto 0 ,(/ 3 2))
'round 'round #f)
 '(-0.1 . 0.1)'(0 . 1.5))
c4

This stencil will not display in SVG output, though it does display fine in
PS and PDF. 

A possible fix may be to change line 86 of /scm/output-svg.scm to force
output as a decimal number. Change from:

(cons (format #f "~S ~S" (car lst) (- (cadr lst)))

to:

(cons (ly:format "~4f ~4f" (car lst) (- (cadr lst)))

Lukas





--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/bad-number-formatting-in-svg-path-output-tp160185.html
Sent from the Bugs mailing list archive at Nabble.com.

___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: bad number formatting in svg path output

2014-03-11 Thread Ralph Palmer
On Thu, Mar 6, 2014 at 1:50 PM, lpietsch  wrote:

> There may be a bug in scm/output-svg.scm, in the function that processes
> stencil expressions created with "(ly:create-stencil '(path ...))". If a
> coordinate in the path expression happens to be the result of a Scheme
> computation that is a fractional rational number, it will be written into
> the SVG output literally as a Scheme fraction (e.g. "3/2"). SVG does not
> understand this format.
>
> Test snippet:
>
> \once \override NoteHead.stencil =
>#(ly:make-stencil `(path 0.2
> '(moveto 0 0
>   rlineto 0 ,(/ 3 2))
> 'round 'round #f)
>  '(-0.1 . 0.1)'(0 . 1.5))
> c4
>
> This stencil will not display in SVG output, though it does display fine in
> PS and PDF.
>
> A possible fix may be to change line 86 of /scm/output-svg.scm to force
> output as a decimal number. Change from:
>
> (cons (format #f "~S ~S" (car lst) (- (cadr lst)))
>
> to:
>
> (cons (ly:format "~4f ~4f" (car lst) (- (cadr lst)))
>
> Lukas


Greetings, Lukas - Thanks for the email. This has been submitted as Issue
3880 : https://code.google.com/p/lilypond/issues/detail?id=3880

Ralph
___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond