Hi Kieren,
On Thu, Sep 19, 2013 at 3:12 PM, Kieren MacMillan < [email protected]> wrote: > Hi David, > > This is nice work… but it doesn't quite work as the OP is expecting, I > think: > > \version "2.17.25" > > #(define (my-callback grob) > (let* ((text (ly:grob-property-data grob 'text)) > (refp (ly:grob-system grob)) > ; This returns all grobs in a line. > (all-grobs (ly:grob-array->list > (ly:grob-object refp 'all-elements))) > ; We're only interested in LyricText grobs. > (just-syllables > (filter > (lambda (x) (grob::has-interface x > 'lyric-syllable-interface)) > all-grobs)) > ; We want the first LyricText grob in the system. We must > locate this > ; by position, since grobs don't seem to be listed in order in > the > ; 'all-elements grob array. > (first-syl > (fold > (lambda (elem prev) > (if (< (ly:grob-relative-coordinate elem refp X) > (ly:grob-relative-coordinate prev refp X)) > elem > prev)) > (car just-syllables) > just-syllables))) > > ; If our LyricText grob is the first on the line, override its > stencil. > (if (eq? grob first-syl) > (begin > (ly:grob-set-property! grob 'text > #{ \markup \combine #text \translate #'(1.6 . -0.5) > \draw-line #'(-4 . 0) #}) > (ly:grob-set-property! grob 'stencil (lyric-text::print > grob)))))) > > melody = \repeat unfold 16 g'4 > lyr = \lyricmode { > \repeat unfold 16 sol > } > \score { > \new Staff << > \new Voice = "voice" { > \melody > } > \new Lyrics \lyricsto "voice" \lyr > \new Lyrics \with { > \override LyricText #'after-line-breaking = #my-callback > } \lyricsto "voice" \lyr > \new Lyrics \lyricsto "voice" \lyr > >> > } > \paper { > indent = 0 > line-width = 5.5\cm > } > > I'm not sure what problem this snippet is illustrating... The image provided by the OP shows that a dividing line is inserted between selected selected stanzas, which you can do by adding the override to a specific Lyrics context as you do above, for each instance needed. Are you referring to the interaction of the line with stanza numbers (which I know is flawed)? --David
_______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
