bug-lilypond
[Top][All Lists]
Advanced

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

Re: horizontal alignment of dynamics attached to skips


From: Neil Puttock
Subject: Re: horizontal alignment of dynamics attached to skips
Date: Sun, 20 Dec 2009 23:45:50 +0000

2009/12/17 Reinhold Kainhofer <address@hidden>:

> Is there any way to make lilypond use the same horizontal position for s\p and
> c\p ???

If you don't care about spanner alignment (i.e., hairpins/dynamic text
spans), then it's possible to realign the dynamics by using NoteColumn
(you can retrieve DynamicText grobs, then reposition them); otherwise
it's waiting for somebody to tackle issue #620.

\override NoteColumn #'before-line-breaking =
#(lambda (grob)
   (let* ((paper-col (ly:grob-parent grob X))
          (elts (ly:grob-object paper-col 'elements))
          (dynamic-text #f))

     (for-each
      (lambda (x)
        (let ((elt (ly:grob-array-ref elts x)))
          (if (and (ly:item? elt)
                   (grob::has-interface elt
                                        'dynamic-interface))
              (set! dynamic-text elt))))
      (iota (ly:grob-array-length elts)))

     (if dynamic-text
         (set! (ly:grob-property dynamic-text 'X-offset)
               (+               
                (ly:self-alignment-interface::x-aligned-on-self dynamic-text)
                (interval-center
                 (ly:grob-robust-relative-extent grob grob X)))))))

(NB: this must be inside a \layout block at Voice level, since there
are no NoteColumn grobs created within Dynamics.)

Regards,
Neil




reply via email to

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