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: Aaron Hill
Subject: Re: Passing arguments to grob-transformer
Date: Fri, 17 Jun 2022 16:41:51 -0700

On 2022-06-17 3:35 pm, Jean Abou Samra wrote:
Le 18/06/2022 à 00:24, Leo Correia de Verdier a écrit :
#(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 }

#(define (elongate amt)
   (grob-transformer
    'stencil
    (lambda (grob original)
      (ly:stencil-scale original 1 amt))))
{  \override Accidental.stencil = #(elongate 2)
   cis'2 }

Also consider expressing this as music function:

%%%%
elongate =
#(define-music-function
  (grob-path amount) (key-list? number?)
  (define proc
   (grob-transformer 'stencil
    (lambda (grob orig)
     (ly:stencil-scale orig 1 amount))))
  #{ \override $grob-path . stencil = #proc #})

{ \elongate Staff.TimeSignature -1.5
  \once \elongate Accidental 2 cis'2 ees' }
%%%%


-- Aaron Hill



reply via email to

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