[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: custom noteheads
From: |
Neil Puttock |
Subject: |
Re: custom noteheads |
Date: |
Sat, 29 Nov 2008 16:17:30 +0000 |
Hi Tao,
2008/11/29 Tao Cumplido <address@hidden>:
> 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