[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Access Clef during after-line-breaking of ClefModifier
From: |
Noeck |
Subject: |
Access Clef during after-line-breaking of ClefModifier |
Date: |
Fri, 17 Apr 2020 01:47:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
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
- Access Clef during after-line-breaking of ClefModifier,
Noeck <=