[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dashed Stem
From: |
David Nalesnik |
Subject: |
Re: Dashed Stem |
Date: |
Fri, 11 May 2012 11:24:34 -0500 |
Hi Urs,
On Fri, May 11, 2012 at 7:06 AM, Urs Liska
<address@hidden> 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
- Dashed Stem, Urs Liska, 2012/05/11
- Re: Dashed Stem,
David Nalesnik <=
- Re: Dashed Stem, David Nalesnik, 2012/05/11
- Re: Dashed Stem, Thomas Morley, 2012/05/11
- Re: Dashed Stem, David Nalesnik, 2012/05/11
- Re: Dashed Stem, Urs Liska, 2012/05/12
- Re: Dashed Stem, David Nalesnik, 2012/05/12
- Re: Dashed Stem, David Nalesnik, 2012/05/12
- Re: Dashed Stem, David Nalesnik, 2012/05/12
- Re: Dashed Stem, David Nalesnik, 2012/05/12
- Re: Dashed Stem, David Kastrup, 2012/05/12
- Re: Dashed Stem, David Nalesnik, 2012/05/12