Hi,
On Tue, May 21, 2013 at 4:32 AM, Gregory Heytings <[email protected]> wrote:
>
>> What should the lyrics be left-aligned to then if not to the note?
>>
>>
> To each other. This would give something like:
>
> o
> Cccc
> Ccccc
> Cc
> Ccc
> c
>
> with the note on the first line, and the lyrics on the five next lines.
> The lyrics are all left-aligned, and the note is centered on the longest
> lyric.
>
>
I'm kind of surprised that this works.
Basically, the idea is that you tag the syllable you want the column to
left-align to by overriding an invented property which I called `tagged'
for lack of any inspiration.
Right now, you need to choose the syllable you want to use for alignment.
I don't imagine it would be difficult to determine the longest
automatically.
The materials between %%%% aren't strictly necessary. Without them, you'll
just get a number of warnings.
Hope this helps!
\version "2.17.17"
%%%%%%%%%%%%%%%%%%%%%%
#(define (define-grob-property symbol type? description)
(if (not (equal? (object-property symbol 'backend-doc) #f))
(ly:error (_ "symbol ~S redefined") symbol))
(set-object-property! symbol 'backend-type? type?)
(set-object-property! symbol 'backend-doc description)
symbol)
#(map
(lambda (x)
(apply define-grob-property x))
`(
(tagged ,boolean? "use this lyric syllable for alignment")
))
%%%%%%%%%%%%%%%%%%%%%%%%
#(define (Lyric_text_align_engraver ctx)
(let ((tag #f)
(syllables '()))
(make-engraver
(acknowledgers
((lyric-syllable-interface trans grob source)
(set! syllables (cons grob syllables))
(if (eq? #t (ly:grob-property grob 'tagged))
(set! tag grob))))
((stop-translation-timestep trans)
(if (ly:grob? tag)
(for-each
(lambda (x)
(if (not (eq? x tag))
(set! (ly:grob-property x 'X-offset)
(ly:grob-property tag 'X-offset))))
syllables))
(set! syllables '())
(set! tag #f)))))
\layout {
\context {
\Score
\consists #Lyric_text_align_engraver
}
}
\score {
\new Staff <<
\new Voice = A {
\relative c' {
c d e f
\break
c d e f
\break
c d e f
}
}
\new Lyrics \lyricsto A {
\once \override Lyrics.LyricText #'tagged = ##t
Cccccc d e f
C d e f
C d e f
}
\new Lyrics \lyricsto A {
C d e f
\once \override Lyrics.LyricText #'tagged = ##t
Cccccc d e f
C d e f
}
\new Lyrics \lyricsto A {
C d e f
C d e f
\once \override Lyrics.LyricText #'tagged = ##t
Cccccc d e f
}
>>
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user