Hi Urs,
On Fri, May 11, 2012 at 7:06 AM, Urs Liska <[email protected]> wrote:
> Am I right that you can't make a Stem dashed? I didn"t find anything in
> the IR.
>
> What would then be the proper way to attach a dashed line to a note in
> place of the Stem?
>
>
Here's something I came up with. It's not ideal. If you compare the
substitute stems with ordinary stems, you'll find differences. (These
relate, I think, to how rounded the lines are--to 'blot-diameter.) But
hopefully this will do.
The argument allows you to specify the number of dashes in your stem.
\version "2.15.38"
#(define (dashed-stem num)
(lambda (grob)
(let* ((stencil (ly:stem::print grob))
(ext (ly:stencil-extent stencil Y))
(len (interval-length ext))
(lst '())
(factors
(map
(lambda (x) (* (/ len (1- (* 2 num))) x))
(iota (* 2 num)))))
(define (helper args)
(set! lst
(cons
(make-line-stencil
0.13 ;; thickness
0 (+ (car ext) (car args))
0 (+ (car ext) (cadr args)))
lst))
(if (null? (cddr args))
lst
(helper (cddr args))))
(if (zero? num)
stencil
(apply ly:stencil-add (helper factors))))))
\relative c'' {
\once \override Stem #'stencil = #(dashed-stem 2)
c
\once \override Stem #'stencil = #(dashed-stem 3)
d
\once \override Stem #'stencil = #(dashed-stem 4)
e
\once \override Stem #'stencil = #(dashed-stem 5)
f
}
HTH,
David
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user