On Fri, Jan 12, 2024 at 6:09 PM Matthew Fong <oxen...@gmail.com> wrote:
I'm trying to replicate lyrics as shown in the red box (the Roman
Missal in English), where
1/ Lyric options are *stacked* and separated by a horizontal line
2/ Lyrics without options are*vertically centered* relative to the
option stack
The following uses TextSpanner for the separating line and the Lyrics
context is aligned to a NullVoice.
%%---------------------------------------------------------
\version "2.24.0"
#(define-markup-command (stacked-lyric layout props one two)
(string? string?)
#:properties ((baseline-skip))
(interpret-markup layout props
(markup
#:translate `(0 . ,(* 0.5 baseline-skip))
#:center-column (one two))))
startStackedLyric =
#(define-music-function (one two)
(string? string?)
(let ((lyric (make-stacked-lyric-markup one two)))
#{
\once \override TextSpanner.style = #'line
\once \override TextSpanner.outside-staff-priority = ##f
\once \override TextSpanner.padding = #0.8
\once \override TextSpanner.bound-details =
#(lambda (grob)
`((left (padding .
,(* -0.5 (interval-length
(ly:stencil-extent
(grob-interpret-markup grob lyric) X))))
(attach-dir . -1))
(right (padding . -0.5))))
\lyricmode { #lyric }
\startTextSpan
#}))
stackedLyric =
#(define-music-function (one two)
(string? string?)
#{ \lyricmode { \markup \stacked-lyric #one #two } #})
stopStackedLyric =
#(define-music-function () ()
#{ \lyricmode { "" } \stopTextSpan #})
\new Staff
<<
\new Voice \relative c'' {
g4 a\breve*1/4 g4
g4 a\breve*1/4 a4
}
\new NullVoice = "aligner" {
g4 a8*4/5 a a a a g4
g4 a8 a4 a8 a4
}
\new Lyrics \lyricsto "aligner" {
\override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding =
#2.5
Through our Lord Jesus Christ, your Son,
\startStackedLyric "who" "who"
\stackedLyric "lives" "live"
\stackedLyric "and reigns" "and reign"
\stopStackedLyric
with
}
>>
\layout {
\context {
\Lyrics
\consists "Text_spanner_engraver"
}
}
%%---------------------------------------------------------
Note that \stopStackedLyric requires a separate note in the NullVoice.
Its note value affects the length to the right of the horizontal line.
I used a somehow similar solution for function theory symbols, based on
the snipped lsr.di.unimi.it/LSR/Item?id=967
<https://lsr.di.unimi.it/LSR/Item?id=967> by Klaus Blum.
All the best,
Thomas
--
Thomas Richter
Vienna / Austria
thomas-rich...@aon.at