Reviewers: , Message: This patch introduces a make-path-stencil function that offers the benefits of the current make-connected-path-stencil function without its limitations:
- Like make-connected-path-stencil it automatically calculates the stencil extents so you don't have to do it manually (no small task when the extents are somewhere on a curve). - Allows use of all path commands, both relative and absolute, not just lineto and curveto. (i.e. lineto rlineto curveto rcurveto moveto rmoveto closepath) This allows "unconnected" paths with multiple segments. (i.e. allows (r)moveto in the middle of the path expression) - Allows optional use of single letter syntax used in standard SVG path commands: L, l, C, c, M, m, Z, z. This is useful for those familiar with the SVG syntax, and makes it convenient to take path code from SVG files and insert it into LilyPond files. (see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) make-connected-path-stencil is still available for use and/or backwards compatibility, but refactored so that it calls make-path-stencil after syntax conversion. Here are some examples to show the syntax: \version "2.18.0" { c'1^\markup \stencil #(make-path-stencil `(rmoveto 0 0 rlineto 2 0 rlineto 0 -2 rlineto -2 0 closepath rmoveto 1.1 -1.1 rlineto 2 0 rlineto 0 -2 rlineto -2 0 closepath rmoveto 1.1 -1.1 rlineto 2 0 rlineto 0 -2 rlineto -2 0 closepath) 0.2 1 1 #f) c'1^\markup \stencil #(make-path-stencil '(m -1 1 c 0 0.75 1 0.75 1 0 c 0 -0.75 -1 -0.75 -1 0 c -1 0 -1 1.5 -0.5 1.5 m 0.5 -1.5 c -1 0 -1 -1.5 -0.5 -1.5 m 1.5 1.5 c 2.5 0 2.5 4 4 4 m -4 -4 c 2.5 0 2.5 -4 4 -4) 0.2 1 1 #f) } Here are snippets demonstrating each of the current ways to make a path stencil: http://lsr.dsi.unimi.it/LSR/Item?id=891 http://lsr.dsi.unimi.it/LSR/Item?id=623 Thanks for reviewing. Description: stencil.scm: add make-path-stencil function supports all path commands both relative and absolute: lineto, rlineto, curveto, rcurveto, moveto, rmoveto, closepath also supports single letter syntax used in standard SVG path commands: L, l, C, c, M, m, Z, z. Refactors make-connected-path-stencil for backwards compatibility and continued use Please review this at https://codereview.appspot.com/54050043/ Affected files (+104, -44 lines): M scm/stencil.scm _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel