lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Descenders affecting line height calculation for lyrics in columns?


From: Bernhard Fisseni
Subject: Re: Descenders affecting line height calculation for lyrics in columns?
Date: Thu, 20 Jan 2022 15:36:29 +0100

Hi Aaron,

thank you for the informative answer!

Aaron Hill schrieb am 20.01.22 um 10:07:
On 2022-01-19 11:41 pm, Bernhard Fisseni wrote:
[ . . . ] In the
song, there are some lines with descenders (p, g, q going below the
baseline).  I show the effect here by inserting "q" in the left
column. Lilypond seems to calculate the "real" line height of the
writing, not some kind of nominal text line height, so that a line
with descenders is higher than a line without. [ . . . ]
Is this the expected behaviour?

No (but kind of yes).

Firstly, \column and \line work properly, respecting baseline-skip and
word-space:

In your code, you have nested \columns within \columns, which does not
work the same as a singular \column would.  \column attempts to align
the contains markups by their respective baselines.  [...]
There are likely many ways to tackle this.  (Other folks on the list
might chime in with their preferred method.)  The simplest option I see
is manually adjusting the baseline-skip between the inner and outer
\columns:
[...]
The math above is that two lines at baseline-skip of three plus an extra
staff space means an effective baseline-skip of seven.

Thank you very much for the explanation! Maybe it would make sense to adjust the manual at <https://lilypond.org/doc/v2.22/Documentation/notation/stanzas> accordingly. I was very surprised that a recommended practice did not work ‘beautifully’.



Secondly, the stanza commands seem to call for defining a two-argument
macro like \columnstanza, but I got lost in the documentation on the
different ways and the different types of objects.

Perhaps something like this:

[...]

Indeed, thank you again! I modified this a little bit to do the adjustment calculation, see below. Given the ease of Kieren's solution, this is possibly just interesting for getting started with the programming and for understanding the object types. Ideally, I would like to arrive at something like

(let ((line-count (sum (length stanzas))))
  ...)

or some calculation of the ‘real’ height of the internal column, just to get rid of superflous parameters. However, I do not know how to do look into the stanzas (I tried using braces within braces for the argument, but that is not accessible the way I thought). One should probably also do the numbering automatically. (That's much less involved, but I would assume it also involves something like recursing on the list of stanzas.)

#(define-markup-command
   (stanza-list layout props stanzas)
   (markup-list?)
   #:properties ((stanza-lines 2)
                 (stanza-baseline-skip 3)
                 (extra-space 1))
(let ((total-skip (+ extra-space (* stanza-lines stanza-baseline-skip))))
     (interpret-markup layout props
       #{
         \markup
           \override #`(baseline-skip . ,total-skip)
           \column {
             #stanzas
           }
       #})))

#(define-markup-command
   (my-stanza layout props number lines)
   (markup? markup-list?)
   #:properties ((stanza-baseline-skip 3)
                 (extra-space 1))
   ; (write stanza-baseline-skip)

   ; (write total-skip)
   (interpret-markup layout props
     #{
       \markup
         \line {
           \bold #number
           \override #`(baseline-skip . ,stanza-baseline-skip)
           \column #lines
         }
     #}))

\markup {
   \fill-line {
     \hspace #1
     \stanza-list {
       \my-stanza "2." {
         "q This is verse two."
         "q It has two lines."
       }
       \my-stanza "3." {
         "q This is verse three."
         "q It has two lines."
       }
     }
     \hspace #1
     \stanza-list {
       \my-stanza "4." {
         "This is verse four."
         "It has two lines."
       }
       \my-stanza "5." {
         "This is verse five."
         "It has two lines."
       }
     }
     \hspace #1
   }
}

Again, grateful for pointers,
Best regards,
  Bernhard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]