Yes! That's much simpler.
No need to take the clippath at all.
I just need to construct the "rest of the box" with generous
dimensions.
I'm kind of stalled on this project until amazon brings my
new music engraving books; but I did try to work-up some
code to handle beaming the stems together into figures.
But the whole thing looks funny with perfectly horizontal
beams. And I've got bad joins! Particularly, the bottom right
corner. I see now why muscript draws the beams as rectangles.
(I'm hoping the books will have guidance on this.)
But the notehead is super-simple now: just 2 curves with
control points arranged like a 6-point domino.
%!
%draw a closed curve 1.5x1 around 0,0
/jigger {
0 .5 moveto
1 0 1 -1 0 -1 rcurveto
-1 0 -1 1 0 1 rcurveto closepath
} def
%draw note head (draw n shrinking curves at x,y and eofill)
/head { %n x y head -
gsave translate
jigger { .7 .9 scale jigger } repeat
eofill grestore
} def
%draw a down-stem
/down {
moveto
-0.75 0 rmoveto
0 -4 2 copy rlineto .12 0 rlineto neg rlineto fill
} def
%draw an up-stem
/up {
moveto
.75 0 rmoveto
0 4 2 copy rlineto -.12 0 rlineto neg rlineto fill
} def
100 500 translate
20 20 scale
.3 setlinewidth
{ gsave
3 {
0 0 0 head 0 0 up
0 2 2 head 2 2 up
0 4 0 head 4 0 up
0 6 2 head 6 2 up
8 0 translate
} repeat
grestore
0 -10 translate
} pop%exec
/a [0 2 0 2 0 2 0 2 0 2 0 2] def
0 a {
0 exch 2 index exch
2 copy down
dup 0 gt { 2 copy pop 0 down } if
head
2 add
} forall
-0.75 -4 moveto 22 -0.75 add -4 lineto stroke
-0.75 -3.5 moveto 22 -0.75 add -3.5 lineto stroke
-0.75 -3.0 moveto 6 -0.75 add -3.0 lineto stroke
8 -0.75 add -3.0 moveto 14 -0.75 add -3.0 lineto stroke
16 -0.75 add -3.0 moveto 22 -0.75 add -3.0 lineto stroke
-0.75 -2.5 moveto 6 -0.75 add -2.5 lineto stroke
8 -0.75 add -2.5 moveto 14 -0.75 add -2.5 lineto stroke
16 -0.75 add -2.5 moveto 22 -0.75 add -2.5 lineto stroke