lilypond-user
[Top][All Lists]
Advanced

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

Re: Changing staff size with custom note head stencils


From: Paul Morris
Subject: Re: Changing staff size with custom note head stencils
Date: Fri, 2 Nov 2012 15:27:01 -0400

On Oct 31, 2012, at 7:11 PM, Paul Morris <address@hidden> wrote:

> On Mike's suggestion I also switched to using internal path stencils instead 
> of embedded PS. The only problem I ran into was using "fill" to get a filled 
> triangle.  I used:
> 
> upTriangle =
> #(ly:make-stencil
>     '(path 0.09
>         '(moveto -.1875 -.5
>           lineto .65625 .5
>           lineto 1.5 -.5
>           closepath
>           fill ()
>           )
>      )
>     (cons -.1875 1.5)
>     (cons -.5 .5)
> )
> 
> When I typeset my file the visual output is correct (filled triangles), but I 
> get either an "Unsupported SCM value for format" error for each of those 
> notes.  (Or if I omit the "()" after "fill" then the rendering fails with 
> "Wrong type argument in position 1 (expecting pair): ()").  I did not find 
> much documentation for "path", only a snippet that doesn't use "fill" [1].  

So I figured out that "fill" above just wanted a pair of values in the right 
format (no parentheses) like this:

          fill 0 . 0 

That worked to avoid the error, but didn't seem quite right (since it didn't 
seem to matter what values you fed it).  So I checked the LilyPond source code 
(scm/output-ps.scm), and it seems like this is the better way to do it:

upTriangle =
#(ly:make-stencil
    '(path 0.09
        '(moveto -.1875 -.5
          lineto .65625 .5
          lineto 1.5 -.5
          closepath
          )
          'round  
          'round  
          #t          
          )
    (cons -.1875 1.5)
    (cons -.5 .5)
)


The #t sets fill to true.  Presto and voila: filled triangle stencils without 
embedded postscript.  ('round and 'round are just default settings for how the 
caps of lines are drawn and how lines are joined.)  

Let me know if I'm missing something, and thanks again for the help.  I will 
see about adding it to the LSR when I get a chance.

-Paul

PS. I wasn't able to get the "make-connected-path-stencil" approach to work, 
but now that the above is working I'm good to go.






reply via email to

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