lilypond-user
[Top][All Lists]
Advanced

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

RE: MetronomeMark alignment after break


From: Daniel Rosen
Subject: RE: MetronomeMark alignment after break
Date: Wed, 19 Dec 2012 19:41:58 +0000

> -----Original Message-----
> From: Kieren MacMillan [mailto:address@hidden
> Sent: Wednesday, December 19, 2012 2:38 PM
> To: Daniel Rosen
> Cc: Xavier Scheuer; address@hidden
> Subject: Re: MetronomeMark alignment after break
> 
> Hi Daniel,
> 
> > Any ideas as to how to work around it in the meantime?
> 
> This hack (can't remember who did this for me?) seems to work.
> 
> Hope it helps!
> Kieren.
> 
> \layout {
>   \context {
>     \Score
>     \override MetronomeMark #'after-line-breaking =
>     #(lambda (grob)
>        (and
>         ;; probably overkill, but better to be on the safe side
>         (= (ly:item-break-dir grob) RIGHT)
>         ;; if the X-parent is suicided, it was originally
>         ;; a copy of the BarLine at the end of the previous
>         ;; system, which means there are no useful break-aligned
>         ;; anchors (e.g., TimeSignature) for the MetronomeMark
>         (not (grob::is-live? (ly:grob-parent grob X)))
>         (let* ((system (ly:grob-system grob))
>                ;; all the useful grobs inside this system as a list
>                (elts (ly:grob-array->list
>                       (ly:grob-object system 'elements)))
>                ;; get the BreakAlignment at the start of the
>                ;; system so we can use its extent to translate the
>                ;; mark away from prefatory matter
>                (alignment (car (filter
>                                 (lambda (g)
>                                   (grob::has-interface g 
> 'break-alignment-interface))
>                                 elts)))
>                ;; get length of BreakAlignment relative to system and add a 
> little
>                ;; padding to ensure skylining doesn't push the mark up
>                (offset (+ 0.5 (interval-length (ly:grob-extent alignment 
> system X)))))
> 
>           ;; move MetronomeMark past BreakAlignment
>           (ly:grob-translate-axis! grob offset X)))
>        ;; call default callback
>        (ly:side-position-interface::move-to-extremal-staff grob))
>   }
> }

Fantastic, thanks!

DR



reply via email to

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