Hi Martín,
Am 08.09.22 um 10:52 schrieb Martín Rincón Botero:
I would like to have less padding for a fermata when a note has an
accidental. Say, if the fermata has a padding of x, I would like it be
x-0.1 or so when the note in question has an accidental. I would be
thankful for a snippet :-).
Scripts (like a fermata) can be added to a chord (instead of a single
note head); which note's accidentals should then be considered?
Anyway, the following snippet changes the padding of a fermata if _any_
of the note heads in the fermata's note column has an accidental:
\version "2.23.10"
mus = \relative {
f''4 fis fis <fis cis>
<fis cis> <fis cis>
}
{
\override Script.before-line-breaking =
#(lambda (script-grob)
(let*
((script-cause (ly:grob-property script-grob 'cause))
(articulation-type (ly:event-property script-cause
'articulation-type))
(default-padding (ly:grob-property script-grob 'padding))
(note-column (ly:grob-parent script-grob X))
(note-heads (ly:grob-array->list
(ly:grob-object note-column 'note-heads)))
(accidentals
(map
(lambda (note-head) (ly:grob-object note-head 'accidental-grob))
note-heads)))
(if (and (eq? articulation-type 'fermata)
(any ly:grob? accidentals))
(ly:grob-set-property! script-grob 'padding
(+ default-padding 2)))))
\time 2/4
<< \mus \repeat unfold 6 s4\fermata >>
% tenuto (and staccato, ...) should not be changed
<< \mus \repeat unfold 6 s4\tenuto >>
}
Note that this needs a fairly recent LilyPond version, since we changed
the 'articulation-type from a string to a symbol at the end of 2021.
Lukas