On 6/10/18 1:16 AM, Aaron Hill wrote:
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
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
Aaron,
Thank you for the documentation reference, your explanation, and
your code example!
BTW, your code example did not compile in 2.18 on macOS, so I
tried to download 2.19 for macOS, but the download link seems to
be down. No problem, though. I was able to rewriting it and
experiment with it - without the nice Scheme automation that you
included.
Below, I
have rewritten your example to show how the lines are still
shifting and do not seem to be solely using the text baseline and
the staff center point. Bounding box/skyline constraints seem to
be included by LilyPond in the calculations for all three
/test-spacing variations. If the bounding box changes from one
staff system to the next (I removed the TALL word in the second
system), then there is a shift, even with the 'padding' variation
of \test-spacing. If I try to use a negative number for
basic-distance (or minimum-distance in my projects) LilyPond logs
and error:
programming
error: insane spring distance requested, ignoring it
continuing,
cross fingers
The
padding variable and \override LyricText.extra-offset = #'(0 . .4)
are the only means I can find to nest text (chord symbols) inside
the barlines of the staff, which is what I want. I also included
in my code example an extension of the length of the barlines to
show that the bounding box of the barlines constrains the
basic-distance variable from nesting the text within the barlines
of the staff.
Also,
LyricText.extra-offset seems to be the only way to dynamically
change the vertical spacing within the \lyricmode block. I cannot
get padding to work within the \lyricmode block. I tried including
the Lyrics and LyricText contexts before VerticalAxisGroup with no
effect.
What I
think is needed is some setting where vertical
bounding-box/skyline safeguards can be turned off for Lyrics (and
ChordNames), thus allowing the rigid positioning of the lyric text
baseline and the nesting of the text (chords) withing the staff
barlines. I still want the text to avoid barlines in the
horizontal dimension! (BTW, I found code in Reference Manual 2.1.2
to make lyrics avoid barlines, so that problem is solved.) If
someone knows enough to tweak the VerticalAxisGroup spacing,
perhaps the option to turning off bounding-box
safeguards/constraints could be allowed as an option, too.
Perhaps, that option is already available, or I am still missing
something. Or maybe, negative numbers could be allowed for
basic-distance and minimum-distance at some point, if that would
solve this.
Of course,
take or leave my beginner musings. I have only done around 80
manuscript rough drafts, so far, which I am now trying to polish.
And, I am only just beginning the chordsheets (I want to make
hundreds of these).
I hope I
can figure out a way to make this work. Thank your for the help!
Peace,
David
%Code
start
\version
"2.18.2"
some-rhythms = \relative b' {
\stemUp b4 b8 b8 b4 b4 | b4 b8 b8 b2 \break
b4 b8 b8 b4 b4 | b4 b8 b8 b2 \break
}
some-lyrics = \lyricmode {
Here are some \markup \center-column { \char ##x2193 low }
words;
some ve -- ry
\markup \scale #'(1 . 2) TALL.
Here are some \markup \center-column { \char ##x2193 low }
words;
some ve -- ry
%If you comment out the TALL text, the lyric line shifts for
all three
% spacing tests.
%\markup \scale #'(1 . 2) TALL.
}
test-spacing-a = #'((basic-distance . -1) (padding . 0))
test-spacing-b = #'((basic-distance . 0) (padding . 0))
test-spacing-c = #'((basic-distance . 0) (padding . -3))
\score { << \new Staff {
\omit Staff.Clef \omit Staff.TimeSignature
\override Staff.StaffSymbol.line-count = #1
%Staff.BarLine.bar-extent causes /test-spacing-a and -b to
shift
% the lyric line outside the barline bounding box/skyline
% text cannot be nested within the barlines using
basic-distance
% (or minimum-distance).
%\override Staff.BarLine.bar-extent = #' (-2.5 . 2.5)
\some-rhythms
}
\addlyrics \some-lyrics
>>
\layout {
ragged-right = ##t
\context
{ \Lyrics
%\test-spacing-a, b, or c shift from one line to
the next.
\override
VerticalAxisGroup.nonstaff-relatedstaff-spacing = \test-spacing-a
%\override
VerticalAxisGroup.nonstaff-relatedstaff-spacing = \test-spacing-b
%\override
VerticalAxisGroup.nonstaff-relatedstaff-spacing = \test-spacing-c
}
}
}
\paper {
indent = 0 % don't indent first system
}
%Code end