Jump to content

Creating text spanners: Difference between revisions

From LilyPond wiki
m New category
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 23: Line 23:
     \markup { \draw-line #'(0 . -2) }
     \markup { \draw-line #'(0 . -2) }
   \once \override TextSpanner.bound-details.right.padding = #-2
   \once \override TextSpanner.bound-details.right.padding = #-2
   a4 \startTextSpan
   a4 \startTextSpan
   b4 c
   b4 c
   a4 \stopTextSpan
   a4 \stopTextSpan


  \set Staff.middleCPosition = #-13
   \override TextSpanner.dash-period = #10
   \override TextSpanner.dash-period = #10
   \override TextSpanner.dash-fraction = #0.5
   \override TextSpanner.dash-fraction = #0.5
Line 38: Line 36:
</lilypond>
</lilypond>


[[Category:Text]]
[[Category:Expressive marks]]
[[Category:Text]]
[[Category:Text]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Expressive marks]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]
[[Category:Snippet]]

Latest revision as of 15:43, 12 December 2025

The \startTextSpan and \stopTextSpan commands allow the creation of text spanners as easily as pedal indications or octavations. Override some properties of the TextSpanner object to modify its output.

\version "2.24"

\paper { ragged-right = ##f }

\relative c'' {
  \override TextSpanner.bound-details.left.text = #"bla"
  \override TextSpanner.bound-details.right.text = #"blu"
  a4 \startTextSpan
  b4 c
  a4 \stopTextSpan

  \override TextSpanner.style = #'line
  \once \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER
  a4 \startTextSpan
  b4 c
  a4 \stopTextSpan

  \override TextSpanner.style = #'dashed-line
  \override TextSpanner.bound-details.left.text =
    \markup { \draw-line #'(0 . 1) }
  \override TextSpanner.bound-details.right.text =
    \markup { \draw-line #'(0 . -2) }
  \once \override TextSpanner.bound-details.right.padding = #-2
  a4 \startTextSpan
  b4 c
  a4 \stopTextSpan

  \override TextSpanner.dash-period = #10
  \override TextSpanner.dash-fraction = #0.5
  \override TextSpanner.thickness = #10
  a4 \startTextSpan
  b4 c
  a4 \stopTextSpan
}