Re: Help with some lyrics gymnastics

2024-01-17 Thread Matthew Fong
Thank you again, Thomas. I'm going to try this out this week!

Matt


Re: Help with some lyrics gymnastics

2024-01-15 Thread Thomas Richter

Hello again,

a few more ideas:

My solution uses the TextSpanner which works for two or more notes. But 
for a single note (syllable), a function like your lyricsWithOption is 
more suitable. The following draws the separating line in the proper length.


%%-

#(define-markup-command (stacked-lyric-single layout props one two)
  (string? string?)
  (let* ((lyric (interpret-markup layout props 
(make-stacked-lyric-markup one two)))

 (width (interval-length (ly:stencil-extent lyric X
    (ly:stencil-add
  lyric
  (make-line-stencil 0.1 0 0.8 width 0.8

%%-

It can be used in the Lyrics context, e.g.

\markup \stacked-lyric-single "you" "God the Father"


For another line thickness, change the first argument of 
make-line-stencil (0.1) and include the following for the TextSpanner in 
the startStackedLyric function with a 10 times larger value:


\once \override TextSpanner.thickness = #1.0


For a proper layout in case of a TextSpanner line break, it could be 
necessary to set the properties of left-broken and right-broken in 
bound-details.



All the best,

Thomas

--

Thomas Richter
Vienna / Austria
thomas-rich...@aon.at

Re: Help with some lyrics gymnastics

2024-01-15 Thread Matthew Fong
Hello Thomas,

That works splendidly. Thank you. The NullVoice is a new concept to me, and
seems necessary here.

I also found the same LSR example and was working through trying to
understand it.


Many thanks,
mattfong


Re: Help with some lyrics gymnastics

2024-01-14 Thread Thomas Richter



On Fri, Jan 12, 2024 at 6:09 PM Matthew Fong  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 
 by Klaus Blum.



All the best,

Thomas

--
Thomas Richter
Vienna / Austria
thomas-rich...@aon.at

Re: Help with some lyrics gymnastics

2024-01-13 Thread David Wright
On Sat 13 Jan 2024 at 08:25:32 (-0800), Matthew Fong wrote:
> Hello everyone,
> 
> I've done a few more things which might be described as hacking using
> \markup.
> 
> \tweak LyricText.self-alignment-X #-0.75
> \markup \center-column { \override #'(baseline-skip . 0.4) \line{ "lives
> and reigns" } \vspace #-0.6 \line { \draw-line #'(19 . 0) } \vspace #-0.1
> \line { "live and reign" }}
> 
> Could this be implemented via something like a TextSpanner? The horizontal
> line has some overhang, but too much and it start a staff on the next line.
> 
> Unfortunately, I cannot change just one portion of the vertical alignment
> using VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding
> 
> Any help is appreciated. Attached is my latest MWE.

Sorry, but can you stop reposting the original with each iteration,
please; I now have three copies, and so does everybody else on this list.

Cheers,
David.