lilypond-user
[Top][All Lists]
Advanced

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

override stencil question


From: Rama Gottfried
Subject: override stencil question
Date: Wed, 6 Mar 2013 22:24:09 -0800

Hi guys,

I'm trying to place control curves between notehead locations -- it seems like I'm getting close, but now I'm stuck.
I was able to find some code that I could adjust to my needs for the most part, but I'm not able to move beyond straight lines so far.

I have a couple questions about the syntax for creating new stencils:
Here is the code that I have which works now - but is just straight lines.

%-------------------
\version "2.17.13"

#(define (path-gliss grob)
    (if (ly:stencil? (ly:line-spanner::print grob))
     (let* ((stencil (ly:line-spanner::print grob))
(X-ext (ly:stencil-extent stencil X))
            (Y-ext (ly:stencil-extent stencil Y))
            (width (interval-length X-ext))
            (len (interval-length Y-ext)))
        
       (ly:stencil-translate 
         (grob-interpret-markup grob
           (markup
             (#:path 0.2
               (list (list 'moveto 0 0)
     (list 'lineto 3 -2)
                     (list 'lineto width len)))))
         (cons (interval-start X-ext) (interval-start Y-ext))))
    #f))            


\relative c' {
\override Stem #'direction = #DOWN
\override NoteHead #'transparent = ##t
\override NoteHead #'no-ledgers = ##t
\override NoteHead #'stem-attachment = #'(0 . -0.25)
\override Glissando #'bound-details = #'((right (0 . 0) (end-on-accidental . #f) (padding . 0.)) (left (0 . 0) (padding . 0.)))

\override Glissando #'stencil = #path-gliss

 c2\glissando e f\glissando g'

}
%----------------

When I try to replace the lineto, with curveto, I get an error message.  Should curveto work here?  For instance:

           (markup
             (#:path 0.2
               (list (list 'moveto 0 0)
     (list 'curveto 0 0 0 0 0 0 width len))))
gives the error:
/Applications/LilyPond.app/Contents/Resources/share/lilypond/current/scm/stencil.scm:386:16: While evaluating arguments to line-min-max in _expression_ (apply line-min-max x):
/Applications/LilyPond.app/Contents/Resources/share/lilypond/current/scm/stencil.scm:386:16: Wrong number of arguments to #<procedure line-min-max (x1 y1 x2 y2)>

Also, in general I'm a little unclear about how stencils are created -- I understand that the path-gliss function above is returning a new stencil which is referred to in the lilypond #'stencil = #path-gliss, however I'm not clear on which part of the function is creating the stencil (or is this a glyph?).  Does the grob-interpret-markup function return a stencil by itself?

If I remove the ly:stencil-translate, or replace it with make-stencil, or ly:stencil-expr, I am able to compile with no errors, but no line is engraved.

So far I haven't been able to find much documentation about this -- please let me know if you know what's going on!

thanks,
Rama



reply via email to

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