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.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.20.0"

% this works but is redefining a standard command
clef =
#(define-music-function (clf) (string?)
   #{
     \override Staff.ClefModifier.extra-offset = #(cond
       ((string=? clf "treble_8") '(1.5 . 1)) ; exaggerated position
       ; there are more conditions in real function
       (#t '(0 . 0))
       )
     #(make-clef-set clf)
   #})

{
  \clef "treble_8"
  a1
  \clef "bass_8"
  c,1
}

% how can I know what kind of clef it is here?
{
  \override Staff.ClefModifier.after-line-breaking =
  #(lambda (grob)
    (ly:grob-set-property! grob 'extra-offset '(1.5 . 1)))
  \clef "treble_8"
  a1
  \clef "bass_8"  % should not work here!
  c,1
}

Best,
Joram

Reply via email to