Jump to content

Controlling spanner visibility after a line break: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
Line 5: Line 5:
Conversely, spanners which are usually visible, such as text spans, can be hidden by enabling the callback.
Conversely, spanners which are usually visible, such as text spans, can be hidden by enabling the callback.


<lilypond version="2.24.0" full>
<lilypond version="2.24" full>
\paper {  
\paper {  
   ragged-right = ##t  
   ragged-right = ##t  

Revision as of 18:44, 16 November 2025

The visibility of spanners which end on the first note following a line break is controlled by the after-line-breaking callback ly:spanner::kill-zero-spanned-time.

For objects such as glissandos and hairpins, the default behaviour is to hide the spanner after a break; disabling the callback will allow the left-broken span to be shown.

Conversely, spanners which are usually visible, such as text spans, can be hidden by enabling the callback.

\version "2.24"

\paper { 
  ragged-right = ##t 
  tagline = ##f
}

\relative c'' {
  \override Hairpin.to-barline = ##f
  \override Glissando.breakable = ##t
  % show hairpin
  \override Hairpin.after-line-breaking = ##t
  % hide text span
  \override TextSpanner.after-line-breaking =
    #ly:spanner::kill-zero-spanned-time
  e2\<\startTextSpan
  % show glissando
  \override Glissando.after-line-breaking = ##t
  f2\glissando
  \break
  f,1\!\stopTextSpan
}