I'm stuck on the last part of getting this working - the part that is
eluding me is getting a short vertical line drawn at the RH end of the
spanner. According the the Internals reference, UP = 1 and DOWN = -1,
and that works fine when I use the return value from the updown function
to set TextSpanner.direction in beginStringNum. But when I try to use
the value returned from updown in the section of code that is commented
out in beginStringNum, I get an error. If I hardcode 1 or -1 instead of
updown then the line is drawn as expected.
I also tried the righttext function below to draw the line: no error is
indicated but neither is the vertical line drawn.
\version "2.17.6"
#(define (updown grob)
(let ((dirn (ly:event-property (event-cause grob) 'direction)))
(if (eq? -1 dirn)
DOWN
UP)))
#(define (righttext grob)
(let ((dirn (ly:event-property (event-cause grob) 'direction)))
(if (eq? -1 dirn)
(markup #:draw-line (cons 0 0.5))
(markup #:draw-line (cons 0 -0.5)))))
beginStringNum = #(define-event-function (parser location strng)
(number?)
#{
\tweak bound-details.left.text \markup\bold\teeny\concat
{ \circle { \finger #(number->string strng) } \char ##x2006 }
\tweak font-shape #'upright
\tweak direction #updown
\tweak bound-details.left.stencil-align-dir-y #CENTER
\tweak dash-period #0.8
\tweak dash-fraction #0.6
\tweak thickness #0.8
\tweak bound-details.right.text #righttext
% \tweak bound-details.right.text \markup {
% \draw-line #(cons 0 (/ updown -2)) }
\tweak bound-details.left.padding #0.25
\tweak bound-details.right.padding #-1
\tweak bound-details.right-broken.padding #0.5
\tweak bound-details.left-broken.padding #2
\tweak bound-details.left-broken.text ##f
\tweak bound-details.right-broken.text ##f
\startTextSpan
#}
)
endStringNum = \stopTextSpan
\relative c {
\clef "treble_8"
c4_\beginStringNum 5 c c \times 2/3 { c8 c c\endStringNum }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user