lilypond-user
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
Re: override stencil question
From
:
Nathan Ho
Subject
:
Re: override stencil question
Date
:
Thu, 4 Jun 2015 11:57:49 -0700
On Thu, Jun 4, 2015 at 11:35 AM, priosfilho
<
address@hidden
>
wrote:
Hey Nathan
This is just the code developed in the thread plus more adjustable handles
for curveto:
Unfortunately this code isn't compiling for me. There are a few extra )'s in there.
I created this from code earlier in the thread; maybe it'll help you:
%%%%
arc = #(list 0 0) %<< global variable to bezier curve handle
glissWidth = #0.2 %<< global variable for glissando width
#(define (set-arc x y)
(set! arc (list x y)))
#(define (get-arc)
arc)
#(define (radians->degrees theta)
(* theta (/ 180 PI)))
#(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))
(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))
(handle (get-arc))) ;<<------------- getting the handle value here
(ly:stencil-translate
(ly:stencil-add
(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 0 0 (first handle) (second 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) (second handle))
(- width (first 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))
\new Staff \with {
\override Glissando #'bound-details = #'((right (attach-dir . 0) (end-on-accidental . #f) (padding . 2.)) (left (attach-dir . 0) (padding . 0.)))
\override Glissando #'stencil = #path-gliss
}
\transpose c c' {
#(set-arc 2 -4)
c2\glissando c''2
}
%%%%
Regards,
Nathan
reply via email to
[
Prev in Thread
]
Current Thread
[
Next in Thread
]
Re: override stencil question
,
priosfilho
,
2015/06/04
Re: override stencil question
,
Nathan Ho
,
2015/06/04
Re: override stencil question
,
priosfilho
,
2015/06/04
Re: override stencil question
,
Nathan Ho
<=
Re: override stencil question
,
priosfilho
,
2015/06/04
Re: override stencil question
,
Nathan Ho
,
2015/06/04
Re: override stencil question
,
priosfilho
,
2015/06/04
Re: override stencil question
,
Nathan Ho
,
2015/06/04
Re: override stencil question
,
priosfilho
,
2015/06/04
Prev by Date:
Re: override stencil question
Next by Date:
Re: override stencil question
Previous by thread:
Re: override stencil question
Next by thread:
Re: override stencil question
Index(es):
Date
Thread