MarcM <m...@mouries.net> writes: > This function apparently worked in version 2.14. > I tried in 2.18 and the line is not printed so the change is not due to a > recent commit. > > I just want to implement a simple function for the music directive "restez" > (*) which is usually indicated with the text "restez" and a line that spans > a list of notes. > > (*) restez [French] > A directive to the performer of a stringed instrument to perform the > indicated passage of a composition remaining on he same note, on the same > string or in the same finger position. > http://dictionary.onmusic.org/terms/2880-restez
The old code presents a few other challenges to convert-ly (it converts anything containing ly:export to a version using $(...) instead of #(...) and that goes wrong in this case), but it's essentially issue 2240 and would (after changing $ back to #), as stated previously, yield to using event-chord-wrap! at the start of the music function. At any rate, here is a "nice" version without such workarounds. add-event seems to be a frequent enough use case to figure out a nice global name for it and provide it in LilyPond proper.
\version "2.18.0" stringNumberSpanner = #(define-music-function (parser location StringNumber music) (markup? ly:music?) (define (add-event mus event) (let ((prop (if (music-is-of-type? mus 'rhythmic-event) 'articulations 'elements))) (set! (ly:music-property mus prop) (append (ly:music-property mus prop) (list event))))) (let ((elts (extract-typed-music music '(rhythmic-event event-chord)))) (if (pair? elts) (begin (add-event (first elts) #{ \tweak style #'solid \tweak font-size #-5 \tweak bound-details.left.stencil-align-dir-y #CENTER \tweak bound-details.left.text \markup { \circle \number $StringNumber } \startTextSpan #}) (add-event (last elts) #{ \stopTextSpan #})))) music) \relative c { \clef "treble_8" \textSpannerDown \stringNumberSpanner "5" { a8 b c d e f } \stringNumberSpanner "4" { g a bes4 a g2 } }
-- David Kastrup
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel