|
From: | David Nalesnik |
Subject: | Re: Lyric separator |
Date: | Thu, 19 Sep 2013 15:55:46 -0500 |
Hi David,
This is nice work… but it doesn't quite work as the OP is expecting, I think:
\new Lyrics \lyricsto "voice" \lyr
\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 \with {\new Lyrics \lyricsto "voice" \lyr
\override LyricText #'after-line-breaking = #my-callback
} \lyricsto "voice" \lyr
>>
}
\paper {
indent = 0
line-width = 5.5\cm
}
[Prev in Thread] | Current Thread | [Next in Thread] |