Thomas Morley <[email protected]> writes:
> How about:
>
> \version "2.19.21"
>
> %% regard output of:
> \displayMusic
> { \tweak style #'harmonic a'1 }
>
> tweakI =
> #(define-music-function (parser location music)(ly:music?)
> (ly:music-set-property! music 'tweaks
> (acons 'style 'harmonic
> (acons 'color red
> (ly:music-property music 'tweaks))))
> music)
>
> { \tweakI a'1 }
>
> %% or:
>
> tweakII =
> #(define-music-function (parser location music)(ly:music?)
> #{
> \tweak color #red
> \tweak style #'harmonic
> $music
> #})
>
> { \tweakII a'1 }
As 2.19.22 is now available for download, let me smugly suggest:
\version "2.19.22"
tweakIII =
#(define-music-function (music) (ly:music?)
(tweak 'color red
(tweak 'style 'harmonic music)))
However, like all of the previous proposals, this relies on "music"
being a single tweakable item. For noteheads, there is the more
thorough style-note-heads function employed by \harmonicNote, so this
part could be done by (harmonicNote music) instead (\harmonicNote uses a
tweak for a single note and override/revert for everything else).
One can also try to do this kind of iteration oneself in order to only
use the less invasive tweaks and get the color covered:
\version "2.19.22"
tweakIV =
#(define-music-function (music) (ly:music?)
(map-some-music
(lambda (m)
(and (music-is-of-type? 'note-event)
(tweak 'color red (tweak 'style 'harmonic m))))
music))
If version 2.19.22 is not available, one can retain the parser/location
arguments and replace the (tweak ...) line by the core of any of Harm's
proposals. map-some-music has been available since 2.16.0 at least, and
all the rest for longer.
--
David Kastrup
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user