On Thu, Jun 4, 2015 at 2:41 PM, priosfilho <pauloriosfi...@gmail.com> wrote:

> Sorry, Nathan. I will try to make my point clearer.
>
> *Firstly*, I got the code developed earlier in this thread and altered the
> numbers of handles of path-gliss to four -- the original version came with
> the values (list 'curveto 0 0 (first handle) (second handle)).
>

Thanks, this is what I was asking for.

It seems that part of the problem is the mailing list wrapping long lines,
so I'll attach the code.

Regards,
Nathan
\version "2.18.2"

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

#(define (radians->degrees theta)
   (* theta (/ 180 PI)))

#(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
            (ly:stencil-add
              (grob-interpret-markup grob
                (markup
                  (#:path glissWidth
                    (list (list 'moveto 0 0)
                          (list 'curveto (first handle) (second handle) (third handle) (fourth handle) width (* height dir))))))
              (ly:stencil-translate
                ; the \rotate markup command doesn't let us pick a rotation center, so we resort to the stencil command
                (ly:stencil-rotate
                  (grob-interpret-markup grob
                    (markup #:arrow-head X RIGHT #t))
                  (radians->degrees
                    ($atan2
                      (- (* height dir) (fourth handle))
                      (- width (third handle)))) 1 0)
                (cons 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))


\relative c' {
  \numericTimeSignature
  \tempo 4=52
\override NoteHead.font-size = #-1.5

$(add-grace-property 'Voice 'NoteHead 'font-size -4.5)


\time 5/8


   \override Score.GraceSpacing.spacing-increment = #7

       \once \override Glissando #'bound-details =
                         #'((right (attach-dir . -2) (end-on-accidental .
#f) (padding . 1))
                            (left (attach-dir . 0) (padding . 0.)))

       \addGliss {
       \once \override Glissando #'stencil = #(path-gliss '(7 1 0 4))
   \grace b16
   a''4.~->}
   \tuplet 5/4 { a16 gis fis, e'-> a,~ }

\time 3/8

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

Reply via email to