lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New "make-path-stencil" function


From: Carl Sorensen
Subject: Re: New "make-path-stencil" function
Date: Tue, 29 Oct 2013 03:51:14 +0000
User-agent: Microsoft-MacOutlook/14.3.8.130913


On 10/28/13 7:26 PM, "Paul Morris" <address@hidden> wrote:

>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)

Cool idea!

>
>- allow "unconnected" paths with multiple segments. (i.e. allow (r)moveto
>in the middle of the path expression)

Seems to allow simplification of complex stencils.

>
>- allow use of different "cap" and "join" styles, not just round.

It's part of the LilyPond engraving aesthetic to use round caps and joins.
 Engraving on metal plates doesn't have sharp corners.  That's why we
don't have the other styles.  If you look at all of our box stencils,
you'll see they have rounded corners.  So I don't think we should support
other cap and join styles.  But I could certainly be overruled here.

>
>
>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.

Does it also work with output-ps.scm?

>
>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).

It seems like we would replace make-connected-path-stencil with
make-path-stencil.

>
>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!

I haven't tried to rewrite your code, but when I first learned Scheme I
was told that anytime you saw lots of set! expressions in the code, you
were trying to write procedural code (I.e. c) instead of functional code
(Scheme).  Your code seems to have lots of set! expressions; it may be
possible to rewrite it in a more functional manner.

Anyway, this is a nice contribution!

Thanks,

Carl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]