lilypond-user
[Top][All Lists]
Advanced

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

Re: Implementing reliable cross-staff stems


From: address@hidden
Subject: Re: Implementing reliable cross-staff stems
Date: Sat, 31 Dec 2011 10:40:20 +0100

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




reply via email to

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