Hi Tao,
2008/11/29 Tao Cumplido <[EMAIL PROTECTED]>:
> Generally I thought I could define a music-function that overrides the
> stencil of a NoteHead depending on the car of ly:make-duration. So if it's
> <=1 it'll place a custom stencil for half and whole notes and if it's >=2 for
> filled notes.
> I hope that makes sense. I just don't know how to do this in lily.
If you're overriding the NoteHead stencil, you can access the property
'duration-log, which will tell you the duration of the current note.
Then you can use case to set the stencil conditionally:
parallelogram =
#(lambda (grob)
; get duration log of NoteHead object
(let* ((dur (ly:grob-property grob 'duration-log)))
(case dur
; if dur = minim, return parallelogram stencil
((2)
(ly:make-stencil (list 'embedded-ps
"gsave
currentpoint translate
newpath
0 0.25 moveto
1.3125 0.75 lineto
1.3125 -0.25 lineto
0 -0.75 lineto
closepath
fill
grestore" )
(cons 0 1.3125)
(cons 0 0)))
; otherwise, set to default print function
(else (ly:note-head::print grob)))))
Regards,
Neil
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user