lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing \tweak-s to engravers


From: Urs Liska
Subject: Passing \tweak-s to engravers
Date: Thu, 14 Jun 2018 11:22:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

I have been banging my head against the wall for quite some time now, but finally I'm at least at a point where I can ask a question here.

I am programmatically attaching a custom grob property to some music and want to later act upon that in an engraver.

When I tried to switch the attachment process from \once \override to \tweak the engraver suddenly didn't recognize the property anymore. First I thought I got it wrong with where the property was attached in the music expression, but now I've realized the following behaviour:

When an engraver is consisted to a Voice or Staff or similar context only properties created through overrides are visible to the acknowledger while tweaks seem to be hidden. However, if I consist the engraver to Score also tweaks are recognized.

The following MWE shows this behaviour with a common grob property, but it's the same with my custom grob property. For my use case in scholarLY it's neither an option to switch back to \once \override (because also \tweak-able post-events have to be supported) nor to consist the engraver to Score (because I need to know from which context the annotations come).

So what do I have to do to make a Voice/Staff-consisted engraver aware of \tweak-s and not only of \override-s?
And why is that behaviour as it is?

%%%
\version "2.19.80"

testEngr =
#(lambda (context)
   (make-engraver
    (acknowledgers
     ((note-head-interface engraver grob source-engraver)
      (ly:message "Notehead color: ~a" (ly:grob-property grob 'color))
      ))))

\layout {
  \context {
% uncomment *one* of the following two lines
    \Staff
    %\Score
    \consists #testEngr
  }
}

\relative {
  \once \override NoteHead.color = #red c'
  \tweak color #red c'
}
%%%


Thanks
Urs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]