On 2/14/11, Dmytro O. Redchuk <brownian....@gmail.com> wrote: > Would be great it if allows to specify which grob's positions to alter, like > this: > > \offsetPositions #"Arpeggio" #'(-2 . 2) >
Hi, Dmytro -- I actually have been working on a snippet which generalizes another function -- namely, the oft-cited snippet for applying 'extra-offset to broken slurs. http://www.lilypond.org/doc/v2.12/Documentation/user/lilypond/Difficult-tweaks#Difficult-tweaks It should be easy to do a similar thing with the positions snippet. Here is my function: offsetBrokenSpanner = #(define-music-function (parser location name offsets) (string? pair?) #{ \overrideProperty $name #'after-line-breaking #(broken-spanner $offsets) #} ) #(define ((broken-spanner offsets) 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)) (ly:grob-set-property! grob 'extra-offset offsets)))) To modify a slur: \offsetBrokenSpanner #"Slur" #'(x . y) To modify a grob in a higher context: \offsetBrokenSpanner #"Staff.OttavaBracket" #'(x . y) My only hesitation is this statement in the NR (section referenced above): "When applying this trick, the new after-line-breaking callback should also call the old one after-line-breaking, if there is one. For example, if using this with Hairpin, ly:hairpin::after-line-breaking should also be called." I confess I don't fully understand this, and hence I'm unsure if my function is overly simplifed. However, calling \offsetBrokenSpanner #"Hairpin" #'(x . y) seems to work as expected. [Note: the issue of contexts is why I used \overrideProperty instead of \override. For some reason, \override will not accept "Staff.OttavaBracket" as a valid grob name. I wonder if there is any drawback to using \overrideProperty, since I've seen it so infrequently.] Best, David _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user