Jump to content

Controlling spanner visibility after a line break: Difference between revisions

From LilyPond wiki
No edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
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" full>
<lilypond version="2.24">
\paper {  
\paper {  
   ragged-right = ##t
   line-width = 50\mm
  tagline = ##f
}
}


Line 30: Line 29:
[[Category:Expressive marks]]
[[Category:Expressive marks]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 12:05, 9 December 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 { 
  line-width = 50\mm 
}

\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
}