On Oct 31, 2012, at 7:11 PM, Paul Morris <p...@paulwmorris.com> 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.




_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to