[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: Passing arguments to grob-transformer
From: Aaron Hill <lilypond () hillvisions ! com>
Date: 2022-06-17 23:41:51
Message-ID: e8674b3dffb04502bef21d307bcaeddb () hillvisions ! com
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic