lilypond-user
[Top][All Lists]
Advanced

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

Re: tweaking grobs after line breaks


From: Neil Puttock
Subject: Re: tweaking grobs after line breaks
Date: Sat, 19 Sep 2009 22:14:28 +0100

2009/9/19 Jonathan Wilkes <address@hidden>:

>     Now I'm trying to use the "my-callback" tweak shown in the NR, and I
> can't get it to change the positions of the first slur in m. 5.  I'd like
> the starting and ending positions of the slur to be at the same vertical
> position, right above the staff.

Your problem here is that by the time 'after-line-breaking is called,
the slur's print function has already done its work and accessed
'control-points: the stencils are already in existence, so in this
case 'after-line-breaking is really only useful for tweaking things
which take place later, like positioning, transparency and colour.

All is not lost though, since you can use the same code directly for
'control-points; the only refinement is that you need to call the
default callback for all cases other than the left-broken slur:

#(define (my-callback grob)
   (let* (
          ;; have we been split?
          (orig (ly:grob-original grob))
          ;; if yes, get the split pieces (our siblings)
          (siblings (if (ly:grob? orig)
                        (ly:spanner-broken-into orig) '() )))
     (if (and (>= (length siblings) 2)
              (eq? (car (last-pair siblings)) grob))
         ;; left-broken -> manual override
         '((4 . 9) (6 . 13) (17 . 14) (21 . 12))
         ;; all other cases, return default value
         (ly:slur::calc-control-points grob))))

\once \override Slur #'control-points = #my-callback

I assume those control-points in your example are just a test, since
that's a rather wild slur. :)

Regards,
Neil




reply via email to

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