lilypond-devel
[Top][All Lists]
Advanced

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

Cross-staff stem engraver (was: New frog in an empty pond?)


From: Pavel Roskin
Subject: Cross-staff stem engraver (was: New frog in an empty pond?)
Date: Fri, 24 Feb 2012 18:04:04 -0500

Hello!

I'm moving the thread to lilypond-devel and changing the subject.  I
hope it's OK.

On Thu, 23 Feb 2012 15:37:02 +0000
Neil Puttock <address@hidden> wrote:

> On 23 February 2012 15:18, Pavel Roskin <address@hidden> wrote:
> 
> > I actually wanted to make a stopgap solution in Scheme.  I wrote
> > some code that looks for other stems and sets the stem length so it
> > would touch the stem above (attached).  But the code is unreliable.
> >  Some stems are not calculated yet.
> 
> I'd love to be proven wrong, but I don't think you'll have much
> success with this approach.  At the very least, you'll need a Scheme
> engraver at the correct context level to collect the stems at the
> right time.  If a simple length override were possible with the
> current infrastructure, we wouldn't need a Span_arpeggio_engraver to
> typeset cross-staff arpeggios.

I tried writing an engraver that could be added to the StaffGroup
context.  Collecting stems is not a problem.  The problem is that even
the finalize handler is called to early.  I'm getting a warning:

programming error: vertical alignment called before line breaking
continuing, cross fingers

Even though the common reference for the Y axis for the stems is a
valid grob of type VerticalAlignment, the Y-extents don't reflect the
distance between staves.

The code for cross-staff arpeggios (span-arpeggio-engraver.cc) only
collects data about stems and lets the standard arpeggio code
(arpeggio.cc) draw the cross-staff arpeggio.

If I understand correctly, an equivalent of that for stems would
require modification to the stem engraver so that it would draw
cross-staff stems.

As for the grid lines, there are actually two engravers.  One makes the
points (GridPoint) and the other connects them (GridLine).  GridPoint
should be hopefully irrelevant, as we have stems for that.  Printing
grid lines is implemented in grid-line-interface.cc.  As I understand,
it's not an engraver (that would be grid-line-span-engraver.cc), it's
an interface.

I checked the Scheme implementation of ambitus engraver.  It relies on
existing implementations of AmbitusLine and other grobs.  The placement
is done in finalize, but ambitus is not cross-staff, so there is no
issue with undefined staff-staff spacing.

I guess I need to rely on an existing grob that supports cross-staff
placement to draw the stem if I want to keep my modification in Scheme.

Perhaps I'll try GridLine, as Arpeggio would need bogus stems and bogus
noteheads to appear where I want it to be.  BarLine also seems to be
too sophisticated for the job.  Maybe there is an example of grob
definition in Scheme?

I'll appreciate comments that would steer me away from dead ends.

-- 
Regards,
Pavel Roskin



reply via email to

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