lilypond-user
[Top][All Lists]
Advanced

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

Re: override stencil question


From: priosfilho
Subject: Re: override stencil question
Date: Thu, 4 Jun 2015 11:35:10 -0700 (MST)

Hey Nathan

This is just the code developed in the thread plus more adjustable handles
for curveto:

% \version "2.17.13"

glissWidth = #0.175 %<< global variable for glissando width

#(define (path-gliss handle)
  (lambda (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))
              (height (interval-length Y-ext))
              (lefty (cdr (assoc 'Y (ly:grob-property grob 'left-bound-info))))
              (righty (cdr (assoc 'Y (ly:grob-property grob 
'right-bound-info))))
              (deltay (- righty lefty))
              (dir (if (> deltay 0) 1 -1))
              
             
              
              )


          (ly:stencil-translate
            (grob-interpret-markup grob
              (markup
                    ;(#: tiny (format "~a" (ly:grob-properties grob)))
                            ;(format "~a" (cdr (assoc 'Y (ly:grob-property grob
'left-bound-info))))
                            ;(#: tiny (format "~a" handle))
                (#:path glissWidth
                  (list (list 'moveto 0 0)
                        (list 'curveto (first handle) (second handle) (third 
handle) (fourth
handle) width (* height dir)))))) 
            
            (if (> dir 0)
                   (cons (interval-start X-ext) (+ (interval-start Y-ext) 0.1))
                   (cons (interval-start X-ext) (+ (interval-start Y-ext) 
height)))))#f)))


#(define (add-gliss m)
   (case (ly:music-property m 'name)
     ((NoteEvent) (set! (ly:music-property m 'articulations)
                      (append (ly:music-property m 'articulations)
                         (list (make-music (quote GlissandoEvent)))))
                   m)
     (else #f)))

addGliss = #(define-music-function (parser location music)
                 (ly:music?)
           (map-some-music add-gliss music))


and in the score:

\relative c' {
%...
\time 5/8 
  {
   \override Score.GraceSpacing.spacing-increment = #7
   
    \addGliss {
          \once \override Glissando #'bound-details = 
               #'((right(attach-dir . -0.5) (end-on-accidental . #t) 
               (padding . 0.5)) (left (attach-dir . 2) (padding . -0.1)))
          \once \override Glissando #'stencil = #(path-gliss '(4 0 1.5 5)) 
   
   \tttts \snh \grace b16^(} 
   < a'' \single \voz-ef c, >4.~->) 
   \override Stem.details.beamed-lengths = #'(6 6 6)
   \tuplet 5/4 {  16 gis fis, e'-> a,~ } 
   \revert Stem.details |
   \revert Score.GraceSpacing.spacing-increment
  }
\time 3/8                                                    
}


-----

To insert the arrow-heads, I tried to implement some lines of the code
discussed in the next link:

http://lilypond.1069038.n5.nabble.com/arpeggio-line-td57703.html
<http://lilypond.1069038.n5.nabble.com/arpeggio-line-td57703.html>  

I tried to adapt that and insert in the glissando code, but that I was not
able to do. 








--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/how-to-create-lines-between-all-consecutive-notes-tp142126p177483.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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