Sat, 15 May 2004 15:51:03 +0200, Jan a dit : 

 > Scott Webber writes:
 >> I'm trying to use lisp or schema or whatever to add postscript to a note,
 >> but I don't really understand the syntax exactly.

 > Try something like:

 > { c c c c-"\\embeddedps{1 1 moveto 2 2 rlineto stroke}" }

 > I'm assuming you use 2.3 CVS, because otherwise you won't be able to
 > use ly snippets inside scheme.  However

 > % can't get this to work
 > #(define (slash x)
 >    ;; #{ \notes { $x-"\\embeddedps{1 1 moveto 2 2 rlineto stroke}" } #}
 >    #{ \notes { $x -"\\embeddedps{1 1 moveto 2 2 rlineto stroke}" } #}
 > )

This does not work because the $x is not replaced by the printed value
of x. Instead, a tmpvariable is introduced, that is bound to the value
of x (ie, 'c), and "\tmpvariable" is then written in the pattern instead of
$x. So you have (define tmpvar x) somewhere and then
  \tmpvar -"\\embeddedps{1 1 moveto 2 2 rlineto stroke}" 
is parsed.

 > % { c c c c #(slash 'c) }

Using def-markup-command or ly:make-music-function :

#(def-markup-command (slash paper props) ()
   (interpret-markup paper props "\\embeddedps{1 1 moveto 2 2 rlineto stroke}"))

slash = #(ly:make-music-function (list ly:music?)
           (lambda (location note)
             (set! (ly:music-property note 'elements)
                   (cons (make-music 'TextScriptEvent
                           'text (markup "\\embeddedps{1 1 moveto 2 2 rlineto 
stroke}"))
                   (ly:music-property note 'elements)))
             note))

\score {
    \notes {
        c'-"\\embeddedps{1 1 moveto 2 2 rlineto stroke}"
        c'-\markup \slash
        \slash c'
    }
}
        
nicolas



_______________________________________________
lilypond-user mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/lilypond-user

Reply via email to