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: Aaron Hill
Subject: Re: Descenders affecting line height calculation for lyrics in columns?
Date: Thu, 20 Jan 2022 01:07:22 -0800

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:

%%%%
\markup
  \override #'(baseline-skip . 4)
  \override #'(word-space . 0.5)
  \box \line {
    \box \line \box {
      \column \box { q q q }
      \column \box { x x x }
      \column \box { b b b }
    }
    \box \column \box {
      \line \box { q x b }
      \line \box { q x b }
      \line \box { q x b }
    }
  }
%%%%

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. The baseline of a \column ends up being the baseline of its first markup. See:

%%%%
\markup \concat {
  \column { q x b }
  "q x b"
}
%%%%

Your inner \columns involve two lines of text which makes them much taller than the default baseline-skip would permit. \column avoids overlapping ink, so it moves markups further down based on their actual extents. Descenders, then, could definitely result in a taller stencil.

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:

%%%%
\markup {
  \fill-line {
    \hspace #1
    \override #'(baseline-skip . 7)
    \column {
      \line { \bold "2."
        \override #'(baseline-skip . 3)
        \column {
          "q This is verse two."
          "q It has two lines."
        }
      }
      \line { \bold "3."
        \override #'(baseline-skip . 3)
        \column {
          "q This is verse three."
          "q It has two lines."
        }
      }
    }
    \hspace #1
    \override #'(baseline-skip . 7)
    \column {
      \line { \bold "4."
        \override #'(baseline-skip . 3)
        \column {
          "This is verse four."
          "It has two lines."
        }
      }
      \line { \bold "5."
        \override #'(baseline-skip . 3)
        \column {
          "This is verse five."
          "It has two lines."
        }
      }
    }
    \hspace #1
  }
}
%%%%

The math above is that two lines at baseline-skip of three plus an extra staff space means an effective baseline-skip of seven.


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:

%%%%
#(define-markup-command
  (my-stanza layout props number lines)
  (markup? markup-list?)
  (interpret-markup layout props #{
    \markup \line {
      \bold #number
      \override #'(baseline-skip . 3)
      \column #lines
    }
  #}))

\markup {
  \fill-line {
    \hspace #1
    \override #'(baseline-skip . 7)
    \column {
      \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
    \override #'(baseline-skip . 7)
    \column {
      \my-stanza "4." {
        "This is verse four."
        "It has two lines."
      }
      \my-stanza "5." {
        "This is verse five."
        "It has two lines."
      }
    }
    \hspace #1
  }
}
%%%%


-- Aaron Hill



reply via email to

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