Dear list,
On list thread Apr 6 2020, Harm provided a Scheme workaround for half-dashed tuplet brackets in non-standard time signatures in version 2.20. However, in using his solution in 2.21.6, if a /tempo marking is included in any staff, I observe that, for the first staff in the score, the custom stencil will always engrave as a fully dashed instead of half-dashed tuplet (and no matter where the /tempo statement occurs, all tuplets in that first staff are affected). Half-dashed tuplet stencils engrave as expected in all other staves regardless of any /tempo statements. Can anyone give any insight as to why? Compare output of the following three examples below.
(Or is there an easier way to do this now altogether in ver 2.21.6? Harm hinted at such features possibly becoming available in future releases.)
Thank you,
Kyle
\version "2.21.6"
%%%SCHEME FUNCTIONS:%%%
#(define (translated-dashed-line->draw-line bool lst)
;; lst is supposed to be a list retrieved from a stencil-_expression_, p.e.
;; (translate-stencil
;; (17.1123059321317 . 0.0)
;; (dashed-line
;; 0.16 <- thick
;; 0.409629549559636 <- on
;; 0.614444324339455 <- off
;; -7.57814666685327 <- x-destination
;; 0.0 <- y-destination
;; 0.0 <- phase
;; ))
;; This procedure will transform it into:
;; (drawline
;; thick
;; x-start
;; y-start
;; x-end
;; y-end)
(if (and bool
(>= (length lst) 3)
(not (eq? (car lst) 'draw-line)))
(let* ((translate (list-ref lst 1))
(dashed-line (last lst))
(thick (list-ref dashed-line 1))
(x-dest (list-ref dashed-line 4))
(y-dest (list-ref dashed-line 5)))
(list
'draw-line
thick
(car translate)
(cdr translate)
(+ x-dest (car translate))
(+ y-dest (cdr translate))))
lst))
#(define (half-solid-tuplet-bracket bool-pair)
(lambda (grob)
(if (and ;; continue if the TupletBracket is dashed
(eq? (ly:grob-property grob 'style) 'dashed-line)
;; continue if left or right part should become solid
(or (car bool-pair) (cdr bool-pair))
;; don't continue, if TupletBracket is omitted
(not (ly:stencil-empty? (ly:grob-property grob 'stencil)))
;; don't continue, if the whole TupletBracket should be dashed
(not (and (car bool-pair) (cdr bool-pair))))
;; make left or right part solid
(let* ((stil (ly:grob-property grob 'stencil))
(x-ext (ly:stencil-extent stil X))
(y-ext (ly:stencil-extent stil Y))
(stil-expr (ly:stencil-expr stil))
(translate (list-ref stil-expr 1))
(combined-stil (last stil-expr))
(new-stencil-expr
(list
'translate-stencil
translate
(cons 'combine-stencil
(map
(lambda (i)
(translated-dashed-line->draw-line
(if (odd? i)
(cdr bool-pair)
(car bool-pair))
(list-ref combined-stil i)))
(iota 4 1 1))))))
(ly:grob-set-property! grob 'stencil
(ly:make-stencil
new-stencil-expr
x-ext
y-ext))))))
halfSolidTupletBracket =
#(define-music-function (pair)(pair?)
#{
\override TupletBracket.after-line-breaking =
#(half-solid-tuplet-bracket pair)
#})
%%%FAILS:%%%
\score {
<<
\new Staff
{
\override TupletBracket.bracket-visibility = ##t
\once \halfSolidTupletBracket #'(#t . #f)
\once \override TupletBracket.style = #'dashed-line
\once \override TupletBracket.edge-height = #'(0.7 . 0)
\tempo 4 = 60
\time 2/5
\times 4/5 { c'16 c'8. c'16 c'16 c'8 } |
}
\new Staff
{
\override TupletBracket.bracket-visibility = ##t
\once \halfSolidTupletBracket #'(#t . #f)
\once \override TupletBracket.style = #'dashed-line
\once \override TupletBracket.edge-height = #'(0.7 . 0)
\tempo 4 = 60
\time 2/5
\times 4/5 { c'16 c'8. c'16 c'16 c'8 } |
}
>>
}
%%% ALSO FAILS:%%%
\score {
<<
\new Staff
{
\override TupletBracket.bracket-visibility = ##t
\once \halfSolidTupletBracket #'(#t . #f)
\once \override TupletBracket.style = #'dashed-line
\once \override TupletBracket.edge-height = #'(0.7 . 0)
\time 2/5
\times 4/5 { c'16 c'8. c'16 c'16 c'8 } |
}
\new Staff
{
\override TupletBracket.bracket-visibility = ##t
\once \halfSolidTupletBracket #'(#t . #f)
\once \override TupletBracket.style = #'dashed-line
\once \override TupletBracket.edge-height = #'(0.7 . 0)
\tempo 4 = 60
\time 2/5
\times 4/5 { c'16 c'8. c'16 c'16 c'8 } |
}
>>
}
%%%FUNCTIONAL:%%%
\score {
<<
\new Staff
{
\override TupletBracket.bracket-visibility = ##t
\once \halfSolidTupletBracket #'(#t . #f)
\once \override TupletBracket.style = #'dashed-line
\once \override TupletBracket.edge-height = #'(0.7 . 0)
\time 2/5
\times 4/5 { c'16 c'8. c'16 c'16 c'8 } |
}
\new Staff
{
\override TupletBracket.bracket-visibility = ##t
\once \halfSolidTupletBracket #'(#t . #f)
\once \override TupletBracket.style = #'dashed-line
\once \override TupletBracket.edge-height = #'(0.7 . 0)
\time 2/5
\times 4/5 { c'16 c'8. c'16 c'16 c'8 } |
}
>>
}