Here's the ps draw_bezier_sandwich routine from line 127 of music-drawing-routines.ps. I've annotated it to show how it pulls "thickness controls" off the stack. I put periods between some values to simplify reading (they're not part of the stack). Currently there are 17 "thickness controls":
/draw_bezier_sandwich % thickness controls { % x4 y4 x5 y5 x0 y0 . x3 y3 . x1 y1 x2 y2 x3 y3 . x0 y0 . linewidth gsave currentpoint translate % round ending and round beginning 1 setlinejoin 1 setlinecap setlinewidth % x4 y4 x5 y5 x0 y0 . x3 y3 . x1 y1 x2 y2 x3 y3 . x0 y0 moveto % x4 y4 x5 y5 x0 y0 . x3 y3 . x1 y1 x2 y2 x3 y3 curveto % x4 y4 x5 y5 x0 y0 . x3 y3 lineto % x4 y4 x5 y5 x0 y0 curveto % (clear) closepath stroke_and_fill grestore } bind def I've noticed a couple of things: 1. the lineto command is redundant. the currentpoint just before is x3 y3, and lineto draws a "line" to the same point. Sometimes in ps this is a way of making sure you get the right linejoin (round here), but in this case the next curveto takes care of that. 2. P(x0,y0) is included twice. ps-commands copy and roll can take care of that. ____________________________________ So the number of thickness controls could be cut down from 17 to 13 if draw_bezier_sandwich was defined as: /draw_bezier_sandwich % thickness controls { % x4 y4 x5 y5 . x1 y1 x2 y2 x3 y3 . x0 y0 . linewidth gsave currentpoint translate % round ending and round beginning 1 setlinejoin 1 setlinecap setlinewidth % x4 y4 x5 y5 . x1 y1 x2 y2 x3 y3 . x0 y0 2 copy % x4 y4 x5 y5 . x1 y1 x2 y2 x3 y3 . x0 y0 . x0 y0 10 2 roll % x4 y4 x5 y5 x0 y0 . x1 y1 x2 y2 x3 y3 . x0 y0 moveto % x4 y4 x5 y5 x0 y0 . x1 y1 x2 y2 x3 y3 curveto % x4 y4 x5 y5 x0 y0 curveto % (empty) closepath stroke_and_fill grestore } bind def If anyone wanted the order of thickness controls to be more intuitive, such as: % linewidth . x0 y0 . x1 y1 x2 y2 x3 y3 . x4 y4 x5 y5 the routine could be defined like this: /draw_bezier_sandwich % thickness controls { % linewidth . x0 y0 . x1 y1 x2 y2 x3 y3 . x4 y4 x5 y5 12 4 roll % linewidth . x4 y4 x5 y5 x0 y0 . x1 y1 x2 y2 x3 y3 7 index 7 index % linewidth . x4 y4 x5 y5 x0 y0 . x1 y1 x2 y2 x3 y3 . x0 y0 15 -1 roll % x4 y4 x5 y5 x0 y0 . x1 y1 x2 y2 x3 y3 . x0 y0 . linewidth gsave currentpoint translate % round ending and round beginning 1 setlinejoin 1 setlinecap setlinewidth % x4 y4 x5 y5 x0 y0 . x1 y1 x2 y2 x3 y3 . x0 y0 moveto % x4 y4 x5 y5 x0 y0 . x1 y1 x2 y2 x3 y3 curveto % x4 y4 x5 y5 x0 y0 curveto % (empty) closepath stroke_and_fill grestore } bind def - Mark _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel