lilypond-user
[Top][All Lists]
Advanced

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

Re: \stopStaff \startStaff spacing & line continuity


From: Jean Abou Samra
Subject: Re: \stopStaff \startStaff spacing & line continuity
Date: Wed, 1 Feb 2023 18:31:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 01/02/2023 02:56, Ahanu Banerjee wrote:
> I am trying to modify the color of the ledger lines for a single note. My 
> understanding is that I need to use \stopStaff and \startStaff for this. 
> However, doing so causes the staff lines to be discontinuous. This rounds the 
> ends of the staff lines surrounding the point at which the staff is stopped 
> and causes adjacent notes to have increased horizontal spacing. How can this 
> be avoided? 
> 
> See code below.
> 
> \version "2.24.0"
> \language "english"
> { g8 \stopStaff \startStaff 
>   \once \override Staff.LedgerLineSpanner.color = green 
>   g \stopStaff \startStaff g g }



Actually a known issue,
https://gitlab.com/lilypond/lilypond/-/issues/3949

You can find a workaround there.

It will change autobeaming and affect spacing even more, though. You could
also try this alternative approach:

\version "2.24.0"

\language "english"

\layout {
  \context {
    \Score
    \override StaffSymbol.width =
      #(lambda (grob)
         (and (unbroken-or-last-broken-spanner? grob)
              (not (let ((sys (ly:grob-system grob)))
                     (and (unbroken-or-last-broken-spanner? sys)
                          (eq? (ly:spanner-bound grob RIGHT)
                               (ly:spanner-bound sys RIGHT)))))
              (+ (interval-end
                  (ly:paper-column::break-align-width
                   (ly:spanner-bound grob RIGHT)
                   (ly:grob-property grob 'break-align-symbols)))
                  0.1)))
  }
}

{
  g8
  \stopStaff
  \startStaff
  \once \override Staff.LedgerLineSpanner.color = green 
  g
  \stopStaff
  \startStaff
  g g
}



Basically, it increases the width of the first staff symbol by a tad in
such a situation in order to make the two overlap.

The effect on spacing is caused by the "paper column" objects that
holds the start/end point of the staff symbols between notes being
marked as "used" because of those staff symbols. You cannot prevent
a column from being marked as used (and if you could, it would mess
up), but as a workaround, you can mark the column between the third
and the fourth note, the one where no staff symbol starts/ends, as
used, like this:

{
  g8
  \stopStaff
  \startStaff
  \once \override Staff.LedgerLineSpanner.color = green 
  g
  \stopStaff
  \startStaff
  g
  \once \override Score.NonMusicalPaperColumn.used = ##t
  g
}


HTH,
Jean



Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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