lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting spanner length


From: Aaron Hill
Subject: Re: Getting spanner length
Date: Thu, 17 Jan 2019 07:36:03 -0800
User-agent: Roundcube Webmail/1.3.8

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/address@hidden/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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]