lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with svg-output


From: address@hidden
Subject: Re: problem with svg-output
Date: Mon, 18 Jul 2011 14:52:21 +0200

On Jul 18, 2011, at 2:23 PM, Stefan Thomas wrote:

> Dear community,
> when I compile the following file with 
> lilypond -dbackend=svg
> the svg-output looks different to the pdf, I've compiled with lilypond.
> The symbol for "muchair" is not displayed correctly.
> Here the example:
> 
> \version "2.14.1"
> %%%%%% note with air
> 
> #(define (airohalf radius height thick)
>     (string-append "gsave
>                     /msellipse {
>                           /endangle exch def
>                           /startangle exch def
>                           /yrad exch def
>                           /xrad exch def
>                           /y exch def
>                           /x exch def
>                           /savematrix matrix currentmatrix def
>                           x y translate
>                           xrad yrad scale
>                           0 0 1 startangle endangle arc
>                           savematrix setmatrix
>                       } def
>                     /rad " (number->string radius) " def
>                     /offset " (number->string height) " rad mul def
>                     /ecenter 0 offset add def
>                     /xradius rad rad mul offset offset mul sub sqrt def
>                     /yradius rad offset sub def
>                     " (number->string thick) " setlinewidth
>                     currentpoint translate
>                     0 0 moveto
>                     newpath
>                             0 rad rad 0 360 arc
>                             fill
>                     0 rad translate
>                     1 1 1 setcolor
>                     newpath
>                             0 ecenter xradius yradius 0 -180 msellipse
>                             closepath
>                             fill
>                     0 0 rad sub translate
>                     0 0 0 setcolor
>                     newpath
>                             0 rad rad 0 360 arc
>                             stroke
>                     grestore"))
> 
> #(define (airuhalf radius height thick)
>     (string-append "gsave
>                     /msellipse {
>                           /endangle exch def
>                           /startangle exch def
>                           /yrad exch def
>                           /xrad exch def
>                           /y exch def
>                           /x exch def
>                           /savematrix matrix currentmatrix def
>                           x y translate
>                           xrad yrad scale
>                           0 0 1 startangle endangle arc
>                           savematrix setmatrix
>                       } def
>                     /rad " (number->string radius) " def
>                     /offset " (number->string height) " rad mul def
>                     /ecenter 0 offset sub def
>                     /xradius rad rad mul offset offset mul sub sqrt def
>                     /yradius 0 rad offset sub sub def
>                     " (number->string thick) " setlinewidth
>                     currentpoint translate
>                     0 0 moveto
>                     newpath
>                             0 rad rad 0 360 arc
>                             stroke
>                     0 rad translate
>                     newpath
>                             0 ecenter xradius yradius 0 -180 msellipse
>                             closepath
>                             fill
>                     grestore"))
> 
> 
> #(define-markup-command (airytone layout props radius height thick)
>    (number? number? number?)
>    (let ((longstring ""))
>      (set! height (max (min height 1) 0))
>      (if (> height 0.5)
>          (set! longstring (airohalf radius (* 2 (- height 0.5)) thick))
>          (set! longstring (airuhalf radius (- 1 (* 2 height)) thick)))
>      (ly:make-stencil
>       (list 'embedded-ps longstring)
>       (cons 0 0) (cons 0 2))))
> 
> muchair =  \markup { \airytone #1.0 #1.0 #0.1 }  
> motiv =  { \times 4/5 {a32-.->\f [ b-.  c'-.   cis'-.   d'-.   ]} }
> \new Staff {
>   \override TextSpanner #'(bound-details left text) = \muchair % der Text, 
> mit der TextSpanner beginnt
> r2 r4 r8  \context Voice << {\motiv} {s8 \startTextSpan  }>> \times 4/5 { 
> cis' 32-.   d'-.   es'-.   \stopTextSpan   r16   } r8 r4 r2 
>   
> } 

You cannot use the embedded-ps command in an SVG (PS does not embed in SVG).
Given that these are drawing simple circles and not ellipses, you can rewrite 
this using LilyPond stencil commands.  These commands will export to all 
backends.

Cheers,
MS




reply via email to

[Prev in Thread] Current Thread [Next in Thread]