[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MetronomeMark alignment after break
From: |
Kieren MacMillan |
Subject: |
Re: MetronomeMark alignment after break |
Date: |
Wed, 19 Dec 2012 14:38:19 -0500 |
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))
}
}