On 2018-06-09 19:43, dfro wrote:
Dear code wizards,
I still have more to solve on this issue, if possible.
I think I have discovered why most of the shifting is happening: The
skyline rather than the baseline of the lyric line text is being
referenced by LilyPond when calculating vertical placement.
[ . . . ]
Perhaps, stacked lyric lines could look more even in their spacing in
some situations, if a 'reference text baseline' setting were available
within the program for VerticalAxisGroup tweaks.
According to the documentation (Notation Reference 4.4.1), ChordNames
and Lyrics already use the baseline as their reference point. And a
Staff uses the vertical center of its StaffSymbol as the reference
point. (If you have set your staff to a single line, then that line
will be its reference.)
You should not need any special setting as this is the default behavior.
Now, that is not to say that the maximal extents are not relevant.
From what I can tell, basic-distance and minimum-distance strictly apply
to the reference points, whereas padding only considers the extents.
That is, if you set basic-distance/minimum-distance to too small a
value, then padding will take precedence to avoid collisions. On the
other hand, if you provide a sufficient value for
basic-distance/minimum-distance, then you will see that spacing is
consistently relative to the reference points. An unusually tall
element can still result in the whole line shifting to honor the
padding, so it takes a bit of work to find a good set of spacing
parameters that will work throughout a long piece.
The following is a *very* contrived snippet, but I think it should help
demonstrate that lyrics indeed use the baseline as the reference point:
%%%%
\version "2.19.81"
\paper { #(set-paper-size "a7landscape") tagline = ##f }
some-rhythms = \relative b' { \stemUp b4 8 8 4 4 | 4 8 8 2 }
some-lyrics = \lyricmode {
Here are some \markup \center-column { \char ##x2193 low } words;
some ve -- ry \markup \scale #'(1 . 2) TALL. }
test-spacing = #(define-void-function (spacing)(list?)
(add-score #{ \score { << \new Staff {
\omit Staff.Clef \omit Staff.TimeSignature
\override Staff.StaffSymbol.line-count = #1
\some-rhythms } \addlyrics \some-lyrics >>
\layout { \context { \Lyrics \override
VerticalAxisGroup.nonstaff-relatedstaff-spacing = $spacing } }
} #}))
\test-spacing #'((basic-distance . 5) (padding . 0))
\test-spacing #'((basic-distance . 0) (padding . 0))
\test-spacing #'((basic-distance . 0) (padding . -5))
%%%%
The first test involves no padding and a basic-distance of five units,
which is measured from the staff line to the baseline of the lyrics.
This is sufficient space to account for the tall lyric along with a
little breathing room. But do notice that the five units is unaffected
by the low lyric.
The second test zeroes out the spacing and tries to go as tight as
possible. You can see that the tall lyric touches the note on the
staff, and the bounding boxes of the staff and lyrics are technically
overlapping.
The third test uses a negative padding to permit the layout to overlap.
With a zero basic-distance, you can see the baseline of the lyrics sit
right on the staff line. Note the low lyric still sits below.
I've attached an image with rules manually overlaid so it is easier to
count the units of spacing.
-- Aaron Hill
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user