Hi all, While working on a snippet for the "make-connected-path-stencil" function[1] I got to thinking about whether it would be possible to write a function that would have all of its benefits but none of its limitations. A function that would combine the benefits of make-connected-path-stencil:
- automatically calculate the stencil extents so you don't have to do this manually. - allow scaling of the stencil. And the benefits of using "ly:make-stencil" with a "path" expression[2]: - allow use of all path commands, both relative and absolute, not just lineto and curveto. (i.e. lineto rlineto curveto rcurveto moveto rmoveto closepath) - allow "unconnected" paths with multiple segments. (i.e. allow (r)moveto in the middle of the path expression) - allow use of different "cap" and "join" styles, not just round. By drawing on the "make-connected-path-stencil" code and the "path" code itself from "output-svg.scm" I've been able to work up a function that can do all of the above, a flexible tool that can handle any "path stencil" job. See the attached file. Eventually I could see a version of this making its way into LilyPond (either alongside or as a replacement of "make-connected-path-stencil"). In the meantime I can put it in the LSR and/or add it to the OpenLilyLib snippet collection (although it's kind of long with the helper functions). If anyone has suggestions for ways to improve the code, I'd be happy to hear them. I'm still learning my way around (often laboriously) with scheme! Cheers, -Paul Here are snippets demonstrating each of the current ways to make a path stencil: [1] http://lsr.dsi.unimi.it/LSR/Item?id=891 [2] http://lsr.dsi.unimi.it/LSR/Item?id=623
make-path-stencil-function.ly
Description: Binary data
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user