Re: Implementing reliable cross-staff stems

2011-12-31 Thread m...@apollinemike.com
On Dec 30, 2011, at 11:47 PM, Pavel Roskin wrote:

 Hello!
 
 I'm trying to implement cross-staff stems that would not get
 disconnected when the distance between staves changes.
 
 Ideally, I need a function that would extend the stem from the note in
 the lower staff exactly until it meets the stem of the note on the
 staff above.
 
 As a simpler solution, I want the stem length to be as long as
 the distance between staves plus or minus a constant.
 
 Since I need both the context and the particular note, I decided to go
 with the \applyOutput approach and filter out non-stems.
 
 That's where I got so far:
 
 #(define (longerstem grob grob-origin context)
   (if (memq 'stem-interface (ly:grob-interfaces grob))
   (set! (ly:grob-property grob 'length)
(cdr (assoc 'Y-extent (ly:context-grob-definition context
 'VerticalAlignment))
 
  \applyOutput #'Voice #longerstem c4 
 
 I get this in the output:
 
 programming error: no pure Y common refpoint
 
 Does anyone have an idea how to deal with it?
 

You can use Scheme engravers.  I use them for exactly this sorta thing.

input/regression/scheme-engraver.ly in the source code for LilyPond (you can 
google this file to find it on a few servers).

Cheers,
MS


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


Re: Implementing reliable cross-staff stems

2011-12-31 Thread Pavel Roskin

Quoting m...@apollinemike.com m...@apollinemike.com:


You can use Scheme engravers.  I use them for exactly this sorta thing.

input/regression/scheme-engraver.ly in the source code for LilyPond   
(you can google this file to find it on a few servers).


Thank you for your reply!  Frankly, I don't understand a thing in that  
file.  I guess I need to learn Scheme for real rather than rely on the  
bits in Lilypond documentation.


But it's good to know of a place where I can look for ideas.  I didn't  
want to delve inside Lilypond sources, as I only wanted to rely on  
documented interfaces.  The test suite may lie somewhere in between,  
so maybe I'll find some ideas there.


Speaking of my problem, it looks like I need to find the grob for the  
pianostaff.  The pianostaff context doesn't seem to have information  
about the actual layout of the staves in a particular place.


--
Regards,
Pavel Roskin

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


Implementing reliable cross-staff stems

2011-12-30 Thread Pavel Roskin
Hello!

I'm trying to implement cross-staff stems that would not get
disconnected when the distance between staves changes.

Ideally, I need a function that would extend the stem from the note in
the lower staff exactly until it meets the stem of the note on the
staff above.

As a simpler solution, I want the stem length to be as long as
the distance between staves plus or minus a constant.

Since I need both the context and the particular note, I decided to go
with the \applyOutput approach and filter out non-stems.

That's where I got so far:

#(define (longerstem grob grob-origin context)
   (if (memq 'stem-interface (ly:grob-interfaces grob))
   (set! (ly:grob-property grob 'length)
 (cdr (assoc 'Y-extent (ly:context-grob-definition context
 'VerticalAlignment))

 \applyOutput #'Voice #longerstem c4 

I get this in the output:

programming error: no pure Y common refpoint

Does anyone have an idea how to deal with it?

-- 
Regards,
Pavel Roskin

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