Re: override stencil question

2015-06-04 Thread Nathan Ho
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


Re: override stencil question

2015-06-04 Thread priosfilho
Good! I appreciate it, Nathan. It works like a charming, now. 







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

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


Re: override stencil question

2015-06-04 Thread Nathan Ho
On Thu, Jun 4, 2015 at 1:14 PM, priosfilho pauloriosfi...@gmail.com wrote:

 Thanks a lot, Nathan! This will really works fine.

 I just have one question now. I would very much appreciate if you could
 help
 me with that.

 I would like to have local control upon all the four variables of list
 'curveto. With the set-arc function you created, I have control only upon
 the two last variables.


Hi Paulo,

I think we're miscommunicating here, because I didn't create the set-arc
function. My code was developed from a version earlier in the thread -- I
couldn't work off your code because it's broken. At the end of the
definition of path-gliss, there's a mismatched )#f))) and the example
doesn't invoke the path-gliss function at all.

I'm sorry, but there's only so much I can do without a working example of
what you're using! If you can provide that, I can complete the task of
getting the arrowhead working in your code.

Regards,
Nathan
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: override stencil question

2015-06-04 Thread priosfilho
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)).

Here's my version of the code:

\version 2.18.2

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))


\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   
 
}

With that, i am able to get that (missing only the arrowhead to get what I
want):

http://lilypond.1069038.n5.nabble.com/file/n177488/example1.png 

---

Then, I got your useful version and was able to get that:

\version 2.18.2


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
 

Re: override stencil question

2015-06-04 Thread Nathan Ho
On Thu, Jun 4, 2015 at 11:06 AM, priosfilho pauloriosfi...@gmail.com
wrote:

 Hi,

 I'm just new to Lilypond, not a programing knower, but just trying to
 follow
 some instructions on the forum so I can finally achieve really beautiful
 scores in a not-too-easy but definitely intelligent way.

 I wanted to make a curved glissando between two notes and this thread
 helped
 me a lot with that. I am able to redraw the curve to fit my intents but by
 now I am just missing an arrow at the end of it pointing to the second
 note's notehead.


Hi Paulo,

Can you show me the code you're using, or link to the thread you got it
from?

Regards,
Nathan
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: override stencil question

2015-06-04 Thread priosfilho
Hi,

I'm just new to Lilypond, not a programing knower, but just trying to follow
some instructions on the forum so I can finally achieve really beautiful
scores in a not-too-easy but definitely intelligent way. 

I wanted to make a curved glissando between two notes and this thread helped
me a lot with that. I am able to redraw the curve to fit my intents but by
now I am just missing an arrow at the end of it pointing to the second
note's notehead. 

http://lilypond.1069038.n5.nabble.com/file/n177481/Screen_Shot_2015-06-04_at_14.png
 

I've been trying hard to do that by inserting arrow-head markup inside what
you coded. But I am just not able to do that. When I get closer, the gliss
curve is gone and I have only the arrow-head attached to the grace note of
the example.

Do you guys have any idea how I could implement this inside this code. Or
maybe it would be a simpler solution for this also.

Thanks!

Paulo

 



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

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


Re: override stencil question

2015-06-04 Thread priosfilho
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)) 
   
   \s \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.

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


Re: override stencil question

2015-06-04 Thread Nathan Ho
On Thu, Jun 4, 2015 at 11:35 AM, priosfilho pauloriosfi...@gmail.com
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
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: override stencil question

2015-06-04 Thread priosfilho
Thanks a lot, Nathan! This will really works fine.

I just have one question now. I would very much appreciate if you could help
me with that.  

I would like to have local control upon all the four variables of list
'curveto. With the set-arc function you created, I have control only upon
the two last variables.

I tried to substitute the line

   (list 'curveto 0 0 (first handle) (second handle) width (* height
dir))

 for:

   (list 'curveto (first handle) (second handle) (third handle) (fourth
handle) width (* height dir))

and the lines

   ($atan2
   (- (* height dir) (second handle))
   (- width (first handle 1 0)

for:

   ($atan2
   (- (* height dir) (fourth handle))
   (- width (third handle 1 0)


...but was not successful. 

Would you help me with that?

Thank you again!

Best,
Paulo




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

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


Re: override stencil question

2013-03-11 Thread David Nalesnik
Hi Rama,

On Mon, Mar 11, 2013 at 12:06 AM, Rama Gottfried
rama.gottfr...@gmail.comwrote:

 Thanks David -- This is great, I can almost start with the score now.

 Glad to hear it!


 I was (am still a bit) unclear about how the grob gets passed to the
 callback function.

 interesting that the grob is still available within the callback without
 passing it -- I had thought that the stencil assignment was passing the
 grob to the callback function with the first argument.  But now if I
 understand correctly, I think the stencil callback function is called
 within the grob parent, and automatically has access to the grob?


Sorry, I would be a bit out of my depth attempting to explain what's going
on.  In any case, I still am passing the grob to the callback function:

#(define (path-gliss handle)
  (lambda (grob)
  [...]

BTW, I could also have written the above as follows:

#(define ((path-gliss handle) grob)

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


Re: override stencil question

2013-03-11 Thread David Nalesnik
On Mon, Mar 11, 2013 at 8:56 AM, David Nalesnik david.nales...@gmail.comwrote:

[...]


 In any case, I still am passing the grob to the callback function:

 #(define (path-gliss handle)
   (lambda (grob)
   [...]

 BTW, I could also have written the above as follows:

 #(define ((path-gliss handle) grob)


Perhaps less cryptic:

 #(define path-gliss
(lambda (handle)
  (lambda (grob)
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: override stencil question

2013-03-10 Thread David Nalesnik
Hi Rama,

On Sun, Mar 10, 2013 at 8:33 PM, Rama Gottfried rama.gottfr...@gmail.comwrote:

 Hi guys,

 I'm making progress, but now am stuck and wondering if you have any advice
 or see anything I'm doing wrong here (code below).

 What I would like to be able to do is specify the handle coordinates for
 the curve for each glissando.
 The problem I'm having is that it seems that all glissandos are using the
 last value for the arc.

 To try to fix the problem I added a call within the stencil callback
 function to get the current value of arc, but this isn't working.

 Any ideas?


The problem here is the use of a top-level variable for the handle
coordinates.  You could fix this by adding an argument to your stencil
function.  I just took a quick look, but I think this will get you on the
right track:

\version 2.17.13

glissWidth = #0.2 % 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 0 0 (first handle) (second 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))

\new Staff \with {
\remove Time_signature_engraver
\remove Clef_engraver
\omit Staff.BarLine
 \override SpacingSpanner
#'base-shortest-duration = #(ly:make-moment 1 32)

\override StaffSymbol #'line-count = #1
\override Stem #'direction = #UP
\override NoteHead #'transparent = ##t
\override NoteHead #'no-ledgers = ##t
\override NoteHead #'stem-attachment = #'(0 . 0)
\override Glissando #'bound-details = #'((right (attach-dir . 0)
(end-on-accidental . #f) (padding . 0.)) (left (attach-dir . 0) (padding .
0.)))
}
\relative b' {
\addGliss {
\once \override Glissando #'stencil = #(path-gliss '(2 4))
c8
\once \override Glissando #'stencil = #(path-gliss '(3 -4))
d
   \once \override Glissando #'stencil = #(path-gliss '(2 4))
a
b }
f
 \addGliss{
d'16
a
c2 }
b32
}


HTH,
David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: override stencil question

2013-03-10 Thread Rama Gottfried
Thanks David -- This is great, I can almost start with the score now.

I was (am still a bit) unclear about how the grob gets passed to the callback 
function.

interesting that the grob is still available within the callback without 
passing it -- I had thought that the stencil assignment was passing the grob to 
the callback function with the first argument.  But now if I understand 
correctly, I think the stencil callback function is called within the grob 
parent, and automatically has access to the grob?

Rama



On Mar 10, 2013, at 8:50 PM, David Nalesnik wrote:

 Hi Rama,
 
 On Sun, Mar 10, 2013 at 8:33 PM, Rama Gottfried rama.gottfr...@gmail.com 
 wrote:
 Hi guys,
 
 I'm making progress, but now am stuck and wondering if you have any advice or 
 see anything I'm doing wrong here (code below).
 
 What I would like to be able to do is specify the handle coordinates for the 
 curve for each glissando.
 The problem I'm having is that it seems that all glissandos are using the 
 last value for the arc.
 
 To try to fix the problem I added a call within the stencil callback function 
 to get the current value of arc, but this isn't working.
 
 Any ideas?
 
 The problem here is the use of a top-level variable for the handle 
 coordinates.  You could fix this by adding an argument to your stencil 
 function.  I just took a quick look, but I think this will get you on the 
 right track:
 
 \version 2.17.13
 
 glissWidth = #0.2 % 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 0 0 (first handle) (second 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))
 
 \new Staff \with {
 \remove Time_signature_engraver
 \remove Clef_engraver
 \omit Staff.BarLine
  \override SpacingSpanner
 #'base-shortest-duration = #(ly:make-moment 1 32)
 
 \override StaffSymbol #'line-count = #1
 \override Stem #'direction = #UP
 \override NoteHead #'transparent = ##t
 \override NoteHead #'no-ledgers = ##t
 \override NoteHead #'stem-attachment = #'(0 . 0)
 \override Glissando #'bound-details = #'((right (attach-dir . 0) 
 (end-on-accidental . #f) (padding . 0.)) (left (attach-dir . 0) (padding . 
 0.)))
 }
 \relative b' {
 \addGliss {
 \once \override Glissando #'stencil = #(path-gliss '(2 4))
 c8
 \once \override Glissando #'stencil = #(path-gliss '(3 -4))
 d
\once \override Glissando #'stencil = #(path-gliss '(2 4))
 a
 b }
 f
  \addGliss{
 d'16
 a
 c2 }
 b32
 }
 
 
 HTH,
 David

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


Re: override stencil question

2013-03-08 Thread David Nalesnik
Hi Rama,

On Fri, Mar 8, 2013 at 12:05 AM, Rama Gottfried rama.gottfr...@gmail.comwrote:

 here is a working version of the bezier glissando (I just had too many
 coordinates in my curveto command).

 still trying to find some reference on the grob-interpret-markup function
 -- it seems there are a few of these grob- functions that are not in the
 documentation list of scheme functions.


There's a reference to it here:
http://www.lilypond.org/doc/v2.17/Documentation/extending/callback-functions

Also, you can find its definition in scm/output-lib.scm.  (BTW, it calls
ly:text-interface::interpret-markup which you'll find documented on the
list of Scheme functions.)

HTH,
David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: override stencil question

2013-03-08 Thread Rama Gottfried
Hi David,

thanks for pointing out the scm folder, I hadn't looked in there yet -- this is 
really helpful.

the list of Scheme functions in the documentation gave me the idea that this it 
was a glossary -- but the scm folder seems like more the place to look for 
getting information.  will start digging in there, thanks!

Rama



On Mar 8, 2013, at 4:46 AM, David Nalesnik wrote:

 Hi Rama,
 
 On Fri, Mar 8, 2013 at 12:05 AM, Rama Gottfried rama.gottfr...@gmail.com 
 wrote:
 here is a working version of the bezier glissando (I just had too many 
 coordinates in my curveto command).
 
 still trying to find some reference on the grob-interpret-markup function -- 
 it seems there are a few of these grob- functions that are not in the 
 documentation list of scheme functions.
 
 There's a reference to it here:  
 http://www.lilypond.org/doc/v2.17/Documentation/extending/callback-functions
 
 Also, you can find its definition in scm/output-lib.scm.  (BTW, it calls 
 ly:text-interface::interpret-markup which you'll find documented on the list 
 of Scheme functions.)
 
 HTH,
 David

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


Re: override stencil question

2013-03-08 Thread Thomas Morley
2013/3/8 Rama Gottfried rama.gottfr...@gmail.com:
 Hi David,

 thanks for pointing out the scm folder, I hadn't looked in there yet -- this
 is really helpful.

 the list of Scheme functions in the documentation gave me the idea that this
 it was a glossary -- but the scm folder seems like more the place to look
 for getting information.  will start digging in there, thanks!

 Rama



 On Mar 8, 2013, at 4:46 AM, David Nalesnik wrote:

 Hi Rama,

 On Fri, Mar 8, 2013 at 12:05 AM, Rama Gottfried rama.gottfr...@gmail.com
 wrote:

 here is a working version of the bezier glissando (I just had too many
 coordinates in my curveto command).

 still trying to find some reference on the grob-interpret-markup function
 -- it seems there are a few of these grob- functions that are not in the
 documentation list of scheme functions.


 There's a reference to it here:
 http://www.lilypond.org/doc/v2.17/Documentation/extending/callback-functions

 Also, you can find its definition in scm/output-lib.scm.  (BTW, it calls
 ly:text-interface::interpret-markup which you'll find documented on the list
 of Scheme functions.)

 HTH,
 David



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


Several examples how it is used in
Snippets-Manual
http://lilypond.org/doc/v2.17/Documentation/snippets-big-page.html#index

and The LilyPond Snippet Repository (LSR)
http://lsr.dsi.unimi.it/LSR/

-Harm

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


Re: override stencil question

2013-03-07 Thread Rama Gottfried
here is a working version of the bezier glissando (I just had too many 
coordinates in my curveto command).

still trying to find some reference on the grob-interpret-markup function -- it 
seems there are a few of these grob- functions that are not in the 
documentation list of scheme functions.

-- rama



\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 'curveto 0 0 4 4 width len)
 (cons (interval-start X-ext) (interval-start Y-ext
  #f))


\relative c' {
\override Stem #'direction = #UP

\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'
}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


override stencil question

2013-03-06 Thread Rama Gottfried
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


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