[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lyric separator
From: |
Kieren MacMillan |
Subject: |
Re: Lyric separator |
Date: |
Thu, 19 Sep 2013 16:12:13 -0400 |
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
}
No doubt you'll find an easy fix.
Best,
Kieren.
- Re: Lyric separator, (continued)
- Re: Lyric separator, Kieren MacMillan, 2013/09/17
- Re: Lyric separator, Benjamin Bloomfield, 2013/09/17
- Re: Lyric separator, Benjamin Bloomfield, 2013/09/18
- Re: Lyric separator, Kieren MacMillan, 2013/09/18
- Re: Lyric separator, Benjamin Bloomfield, 2013/09/18
- Re: Lyric separator, Kieren MacMillan, 2013/09/18
- Re: Lyric separator, Benjamin Bloomfield, 2013/09/19
- Re: Lyric separator, David Nalesnik, 2013/09/19
- Re: Lyric separator, David Nalesnik, 2013/09/19
- Re: Lyric separator, Benjamin Bloomfield, 2013/09/19
- Re: Lyric separator,
Kieren MacMillan <=
- Re: Lyric separator, David Nalesnik, 2013/09/19
- Re: Lyric separator, Kieren MacMillan, 2013/09/19
- Re: Lyric separator, David Nalesnik, 2013/09/19
- Re: Lyric separator, Kieren MacMillan, 2013/09/19
- Re: Lyric separator, Thomas Morley, 2013/09/19
- Re: Lyric separator, Kieren MacMillan, 2013/09/19
- Re: Lyric separator, Benjamin Bloomfield, 2013/09/20
- Re: Lyric separator, David Nalesnik, 2013/09/20
- Re: Lyric separator, Janek Warchoł, 2013/09/20
- Re: Lyric separator, David Nalesnik, 2013/09/20