bug-lilypond
[Top][All Lists]
Advanced

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

Automatically shift dynamics horizontally?


From: Urs Liska
Subject: Automatically shift dynamics horizontally?
Date: Wed, 27 Jan 2016 10:19:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

The fact that dynamics are always aligned to their notes can cause
unnecessarily large distances between staves as you can for example see
in the attached image generated from the following code.

\version "2.19.35"

off = {
% uncomment either of the following lines
%  \once \override DynamicText.X-offset = -3
%  \once \override DynamicText.X-offset = -3.5
}

\score {
  \new PianoStaff <<
    \new Staff \relative c'' {
      <<
        {
          \voiceOne
          c2 2
        }
        \new Voice {
          \voiceTwo
          e,4 c \off g \sf g'
        }
      >>
    }
    \new Staff \relative g {
      \clef bass
      <<
        {
          \voiceOne
          g4 a8 b c4 b8 a
        }
        \new Voice {
          \voiceTwo
          c,1
        }
      >>
    }
  >>
}

In such situations one will usually shift the dynamics to the left, and
Lily will automatically use the space better. You can see that when you
uncomment one of the lines in \off.

Would there be a way to approach this problem automatically, presumably
controlled by a configuration variable?

Basically a DynamicText (would this be true for other grobs as well? I
can't think of any) would - after line breaking is finished - have to
determine if it is the lowest element in a staff, and then consider
moving left until it can be shifted upwards. Is this possible?

I think this is something that would greatly reduce the number of cases
where LilyPond produces ugly layout by default, so it should be worth
exploring.

Best
Urs

Attachment: dynamic-increases-staff-distance.png
Description: PNG image


reply via email to

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