lilypond-devel
[Top][All Lists]
Advanced

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

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


From: Pavel Roskin
Subject: Re: Cross-staff stem engraver (was: New frog in an empty pond?)
Date: Sun, 26 Feb 2012 00:14:03 -0500
User-agent: Internet Messaging Program (IMP) H3 (4.1.4)

Quoting Joe Neeman <address@hidden>:

The problem is where you ask for the stem Y-extent relative to yref (the
VerticalAlignment): in order to calculate the vertical distance between the
various staves and the VerticalAlignment, line breaking needs to be done
first. (And line breaking doesn't happen until after all the engravers are
done.)

I see. It means that using an engraver it not a solution per se. Good to know.

I guess I'll need to redefine the stencil for stems.  Or maybe you mean
some other callback?


You could redefine stencil, but I think redefining length would be easier.

Of course, that's why I tried it first :)

Can you be more specific about the Y-extent not being calculated yet? When
you ask for the Y-extent, the calculation should be triggered if it hasn't
already happened.

Now I understand what's going on! Apparently this triggering is not transitive (which is reasonable). I'm attaching the minimal example when I get

grob Y-extent: (+inf.0 . -inf.0)

I think it should be possible to work around. I'll be perfectly fine if my code doesn't work with chords spanning three and more staves if that limitation needs to exist.

As a general approach, setting length sounds like a reasonable way forward.
In addition, I'd suggest creating a new stem in process-acknowledged, then
doing

(set! (ly:grob-object new-stem 'spanned-stems) old-stems)
(set! (ly:grob-property new-stem 'length) your-length-callback)

In your length callback, you read back the spanned-stems object and do your
calculations. Is this similar to what you tried?

I never used an engraver and the length override at the save time. When doing the length override, I tried this approach:

- find PaperColumn among the grob parents
- scan its elements for stems
- use stems extents to find stems connectable to the given stem
- find the closest stem
- use the length that would extend the given stem to the closest stem

It actually worked, except some corner cases.  Now I understand why.

Using an engraver to catch the stems sounds like a good approach. I could even do some filtering in the engraver. And it should be possible to replace stems with one rather than connect them together. It would simplify SVG output, and I suspect the connect point could be seen in some renderings of the postscript output.

Thank you for your help!  I'm getting really close!

--
Regards,
Pavel Roskin

Attachment: stemconnect.ly
Description: Text Data


reply via email to

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