In Lilypond there is the TextSpanner object. I'd like to modify the default dashed line as follows:

  1. increase the thickness of the line
  2. increase the density of the dashes (the white spaces are too long by default). However the length of the dashes are ok.
  3. center-align the dashed line and the text on the left. By default it is bottom-algined.

How to do this? Many thanks in advance!


As for your second and third question, the following may help:

useCustomSpan = {
  \override TextSpanner.bound-details.left.text = \markup{ \musicglyph #"pedal.*" }
  \override TextSpanner.bound-details.left.stencil-align-dir-y = #0
  \override TextSpanner.dash-fraction = 0.5
  \override TextSpanner.dash-period = 1
  % \override TextSpanner.thickness = 2

\score {
  \relative c'' {
    c4\startTextSpan d e f g2\stopTextSpan e

enter image description here

You can modify the dash-fraction and the dash-period properties of the TextSpanner object in order to get the desired dash pattern, and you can change the stencil-align-dir-y property for the left text to #0, which means that is is vertically centered.

As for your first question, there is also the property TextSpanner.thickness. However, I think the line thickness is already quite alright, so I commented it out in the above code.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.