On 2019-01-17 6:43 am, Leo Correia de Verdier wrote:
Dear list!

I’m all new to lily pond and trying to create a custom spanner (a couple of parallel lines connecting some of the holes of two fingering charts). To hack this together I would need the length of the spanner I’m modifying or
replacing. I’ve put this piece of code together to extract it and can’t
understand what mistake I’ve made:

\version "2.18.2"
\relative c'' {
  \once \override TextSpanner.stencil =
  #(lambda (grob)
     (let (grob-X (interval-length (ly:stencil-extent (ly:grob-property
grob 'stencil) X)))
       (make-line-stencil .2 1 1 grob-X 4)
       )
     )
  d \startTextSpan
  c b
  a \stopTextSpan
}


I attempted to abstract it from this piece of code
https://www.mail-archive.com/[email protected]/msg81685.html

Do you have any other sources or better suggestions for custom spanners?
This doesn’t have to be very complex or be able to cover line breaks.

Two issues:

- You are missing a set of parentheses for the let statement.
- You are attempting to query a grob property from within the property.

Try this:

%%%%
\version "2.18.2"
\relative c'' {
  \once \override TextSpanner.stencil =
  #(lambda (grob)
     (let ((grob-X (interval-length
        (ly:stencil-extent (ly:line-spanner::print grob) X))))
       (make-line-stencil .2 1 1 grob-X 4)))
  d \startTextSpan
  c b
  a \stopTextSpan
}
%%%%


-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to