On 2/10/2019 8:19 PM, Andrew Bernard wrote:
I want to have markup such as ST over the clefs at the start of each
page in a section of the string quartet I am doing. This is to
indicate ongoing ST technique over extended sections, as a reminder to
the player. Clefs don't appear to support markup. Rehearsal marks
would be fine, but I only get one on the first staff of the four.
You can see the sort of thing in the picture here.
Any suggestions?
Andrew
(sorry my attachment didn't go through on my last email)
\version "2.19.82"
annotateClef =
#(define-music-function (padding text-above text-below) ((number? 1)
markup? markup?)
#{
\once \override Staff.Clef.after-line-breaking =
#(lambda (grob)
(let*
((stencil (ly:clef::print grob))
;; miniml distance between center staff line and markup
(padding-threshold 5)
;; reference point of the original clef
(vpos (/ (ly:grob-property grob 'staff-position) 2))
;; upper and lower edges of the clef
(vextent (ly:stencil-extent stencil Y))
(clef-top (+ vpos (cdr vextent)))
(clef-bottom (+ vpos (car vextent)))
;; calculate padding acknowledging distance to clef *and* to
staff
(padding-top (max padding (- padding-threshold clef-top)))
(padding-bottom (max padding (+ padding-threshold clef-bottom)))
;; create stencil for upper text and horizontal shift for
centering
(markup-stencil-above (grob-interpret-markup grob text-above))
(shift-above (- (interval-center (ly:stencil-extent stencil X))
(interval-center (ly:stencil-extent
markup-stencil-above X))))
;; create stencil for lower text
(markup-stencil-below (grob-interpret-markup grob text-below))
(shift-below (- (interval-center (ly:stencil-extent stencil X))
(interval-center (ly:stencil-extent
markup-stencil-below X))))
;; combine the three stencils
(new-stencil
(ly:stencil-combine-at-edge
(ly:stencil-combine-at-edge
stencil Y DOWN
(ly:stencil-translate-axis markup-stencil-below shift-below X)
padding-bottom)
Y UP
(ly:stencil-translate-axis markup-stencil-above shift-above X)
padding-top)))
(ly:grob-set-property! grob 'stencil new-stencil)))
#})
\relative {
\annotateClef "Markup" ""
\clef treble
c'1
\annotateClef "A.B.C." ""
\clef tenor
c1
\annotateClef "D.E" ""
\clef soprano
c1
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user