Hello Harm, Stéfano,
I always underestimate the usability of before/after-line-breaking ...
Based on Harms code I scratched a music-function to conditionally omit
the accidental. This one can be used with the EE.
It smells a bit hacky, but it seems to work and is extendable for other
use cases.
HTH
Jan-Peter
Am 01.02.2018 um 22:49 schrieb Thomas Morley:
2018-02-01 16:59 GMT+01:00 Stefano Troncaro <stefanotronc...@gmail.com>:
Ideally, I wanted a function
that I could use with the edition-engraver to tweak target elements inside
chords. I framed the question around accidentals in the post above, but
ultimately I hoped to be able to use the same function (or a very similar
one) to tweak ties of specific notes instead of being forced to use one
override for the whole chord, or to tweak other properties of specific notes
should the need arise.
Well, we have
(1) override.
Aplied to a chord it will work on all relevant grobs found.
One could define some selection, ofcourse.
Like:
command =
\override NoteHead.before-line-breaking =
#(lambda (grob)
(let* ((cause (ly:grob-property grob 'cause))
(pitch (ly:prob-property cause 'pitch))
(alteration (ly:pitch-alteration pitch))
(accidental (ly:grob-object grob 'accidental-grob)))
(if (and (ly:grob? accidental) (eqv? alteration 1/2))
(ly:grob-set-property! accidental 'stencil #f))))
But you wrote you would prefer to address specific notes, not the whole chord.
Therefore we have:
(2) tweak
But you didn't like the already proposed
\single \omit Accidental
which _is_ a tweak
(3) context-properties
basically accidentalStayle sets context-properties.
But ofcourse can't change other note-head-properties as you seem to like.
So I'm at a loss guessing what you desire.
Cheers,
Harm
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
\version "2.19.80"
\include "oll-core/package.ily"
\loadPackage edition-engraver
\consistToContexts #edition-engraver Voice.Staff.Score
condGrobTweak =
#(define-music-function (use_octave pred_pitch grob_proc)((boolean? #f) ly:pitch? procedure?)
(let ((pred_note (ly:pitch-notename pred_pitch))
(pred_alteration (ly:pitch-alteration pred_pitch))
(pred_octave (ly:pitch-octave pred_pitch)))
#{
\override NoteHead.before-line-breaking =
#(lambda (grob)
(let* ((cause (ly:grob-property grob 'cause))
(pitch (ly:prob-property cause 'pitch))
(note (ly:pitch-notename pitch))
(alteration (ly:pitch-alteration pitch))
(octave (ly:pitch-octave pitch)))
(if (and (eqv? alteration pred_alteration)
(eqv? note pred_note)
(or (not use_octave)(eqv? octave pred_octave)))
(grob_proc grob))))
#}))
#(define (omit-accidental grob)
(let ((accidental (ly:grob-object grob 'accidental-grob)))
(if (ly:grob? accidental)
(ly:grob-set-property! accidental 'stencil #f)
)))
\addEdition accidentals
\editionMod accidentals 1 0/4 Voice \once \condGrobTweak gis #omit-accidental
{ <cis' eis' gis' ais'> }
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user