On Mon, May 21, 2012 at 9:09 AM, padovani
<address@hidden> wrote:
Hello,
I'm dealing with special noteheads I've designed and I need to move the stem and the flag differently if stem direction is up or down.
I would like to create a guile lisp clause that sets the extra-offset value accordingly to the Stem position.
I was trying this, but it does not work...
\once \override Stem #'extra-offset = #(if (eqv? ly:stem::calc-direction UP) '(-0.02 . -0.25) '(0.02 . 0.25))
(also tried this...
\once \override Stem #'extra-offset = #(if (ly:dir? ly:stem::calc-direction UP) '(-0.02 . -0.25) '(0.02 . 0.25))
)
any tips?
You're almost there, but ly:stem::calc-direction is a procedure which needs the Stem grob as its argument. So you can do this:
\version "2.14.2"
\relative c'' {
c c'
\override Stem #'extra-offset =
#(lambda (grob) (if (eqv? (ly:stem::calc-direction grob) UP)
'(-0.02 . -0.25) '(0.02 . 0.25)))
c, c'
}
BTW, you could also use ly:grob-property here to get the direction of the stem:
\override Stem #'extra-offset =
#(lambda (grob)
(if (eq? (ly:grob-property grob 'direction) UP)
'(-0.02 . -0.25) '(0.02 . 0.25)))
HTH,
David