Am 26.12.21 um 17:13 schrieb Lukas-Fabian Moser:
Hi Kieren,
Am 26.12.21 um 16:48 schrieb Kieren MacMillan:
Hi all,
Given
\version "2.21"
{ \omit Script c''1^\fermata_\espressivo }
obviously both Script grobs will be omitted; same, of course, with
\version "2.21"
\layout { \context { \Score \omit Script } }
{ c''1^\fermata_\espressivo }
Is there a way (e.g., via callback or improved \omit function
definition) to make \omit more surgical? For example, can one
effectively say
\omit #'(fermata) Script
so that only fermatas get omitted?
Perhaps something like:
Or, with a little bit more sugar:
\version "2.22"
omitScriptTypes =
#(define-music-function (types) (symbol-list?)
(let
((stencil
(lambda (grob)
(if (memq
(string->symbol
(ly:event-property (ly:grob-property grob 'cause)
'articulation-type))
types)
#f
ly:script-interface::print))))
#{
\override Script.stencil = #stencil
#}))
example = { a'4\fermata a'\tenuto a'\espressivo a'\marcato }
{
\omitScriptTypes fermata
\example
\omitScriptTypes fermata, tenuto
\example
\omitScriptTypes tenuto, espressivo, marcato
\example
\omitScriptTypes #'()
\example
}
(I'm a bit surprised that the articulation type is stored in a string
instead of a symbol; maybe there's another property that I'm
overlooking, as my call to string->symbol isn't really what you would
call elegant.)
Lukas