On 2019-03-25 2:42 am, Andrew Bernard wrote:
Anybody?

I have tried experimenting with large values of \override
DynamicLineSpanner.staff-padding to no avail. I am stumped. Is it a bug?

While it may not be ideal, to me this is not a bug. DynamicLineSpanners behave differently when not started or terminated on the same note as a corresponding DynamicText. Because otherwise, the two dynamic items have no knowledge of each other and ultimately have to fend for themselves amongst the rest of the "outside-staff" items.

Even within a \Dynamics context it is not so much that items are aligned to each other but rather to a common reference point that just so happens to make it *look* like they know about each other.

Consider the following:

%%%%
\version "2.19.82"
\paper { indent = 0 line-width = 5\in ragged-right = ##f }
\layout { \omit Staff.TimeSignature }

test = {
  %% Overlay reference lines.
  \once \override Hairpin.stencil =
    #(grob-transformer 'stencil (lambda (grob orig)
      (grob-interpret-markup grob #{
        \markup \with-dimensions-from \stencil $orig \overlay {
          \with-color #(rgb-color 0.4 0.7 1.0)
          \path #0.2 #'((moveto -2 0) (lineto 66 0))
          \with-color #(rgb-color 1.0 0.4 0.7)
          \path #0.2 #'((moveto 0 0) (lineto 0 7) (moveto -2 7)
            (lineto 2 7) (moveto -1 5.5) (lineto 0 7) (lineto 1 5.5))
          \stencil $orig } #})))
  | g4\p\< g'2.\!
  | g4\p g4\< g'2\!
  | g4\p g'4\< g'2\!
  | g'2.\< g4\!\f
  | g'2\< g4\! g4\f
  | g'2\< g'4\! g4\f \break
}
{
  \test
  \override DynamicLineSpanner.minimum-space = #7
  \override DynamicLineSpanner.padding = #0
  \override DynamicLineSpanner.staff-padding = #0
  \test
}
%%%%

The first system demonstrates the default vertical alignment. Note that the only time the hairpins and dynamics line up "properly" is when they start and stop together.

The second system shows that by adjusting some variables you can essentially request all of the dynamic items to be a certain distance away from the staff. Note that this is simply a request, and that other "outside-staff" items can shift the final positioning.

At the end of the day, if you absolutely need perfect alignment, the \Dynamics context really is the way to go. Consider this usage:

%%%%
\version "2.19.82"
test = {
  | g4\p\< g'2.\! | g4\p g4\< g'2\! | g4\p g'4\< g'2\!
  | g'2.\< g4\!\f | g'2\< g4\! g4\f | g'2\< g'4\! g4\f
}
<<
  \new Staff \with { \omit Hairpin \omit DynamicText } \test
  \new Dynamics \test

%%%%

This is a cheap way to avoid duplicating effort on the \Dynamics context.

-- Aaron Hill
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to