On 2020-04-16 4:47 pm, Noeck wrote:
Hi,
I have redefined the \clef command to sneak in an override to the
ClefModifier. That works but I can't use it as a layout as it is "baked
in" the music expression.
I guess there is some "after-line-breaking" solution with a lambda
function operating on the grob (ClefModifier). But I could not find it.
I would need access to the kind of clef, the ClefModifier is attached
to.
While you can get to the Clef grob from the ClefModifier, the original
string "treble_8" is not accessible near as I can tell. You are however
able to reverse engineer it given the glyph, direction, and text:
%%%%
\version "2.20.0"
{
\override Staff.ClefModifier.color = #red
\override Staff.ClefModifier.extra-offset =
#(lambda (grob)
(let* ((clef (ly:grob-parent grob X))
(glyph (ly:grob-property clef 'glyph))
(dir (ly:grob-property grob 'direction))
(text (markup->string (ly:grob-property grob 'text))))
(cond
;; treble_8
((equal? (list glyph dir text) (list "clefs.G" DOWN "8"))
'(1.5 . 0.5))
;; bass^15
((equal? (list glyph dir text) (list "clefs.F" UP "15"))
'(-1.5 . 0.5))
(else '(0 . 0)))))
\clef "treble^15" R1
\clef "treble_8" R1
\clef "bass^15" R1
\clef "bass_8" R1
}
%%%%
-- Aaron Hill