lilypond-user
[Top][All Lists]
Advanced

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

Re: Passing arguments to grob-transformer


From: Jean Abou Samra
Subject: Re: Passing arguments to grob-transformer
Date: Sat, 18 Jun 2022 00:35:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1



Le 18/06/2022 à 00:24, Leo Correia de Verdier a écrit :
Dear list!
I’m quite likely just being somewhat dim, but is there a way to pass additional 
arguments to a function used by grob-transformer (or any callback for that 
matter)?
  Would it be possible to do something equivalent to this following using an 
override to the stencil using grob-transformer?

\version "2.23.7"

#(define elongate (lambda (grob amt)
                     (let ((stil (ly:grob-property grob 'stencil)))
                       (ly:grob-set-property! grob 'stencil (ly:stencil-scale 
stil 1 amt)))))

{  \override Accidental.before-line-breaking = #(lambda (grob) (elongate grob 
2))
    cis'2 }

Thanks!
/Leo



Like this?

\version "2.23.9"

#(define (elongate amt)
   (grob-transformer
    'stencil
    (lambda (grob original)
      (ly:stencil-scale original 1 amt))))

{  \override Accidental.stencil = #(elongate 2)
   cis'2 }


You might want to read this part of the Guile manual:

https://www.gnu.org/software/guile/manual/html_node/About-Closure.html#About-Closure

Best,
Jean





reply via email to

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