lilypond-devel
[Top][All Lists]
Advanced

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

Re: Vertical alignment of the figures in BassFigureAlignment


From: Reinhold Kainhofer
Subject: Re: Vertical alignment of the figures in BassFigureAlignment
Date: Sat, 27 Feb 2010 13:39:56 +0100
User-agent: KMail/1.12.4 (Linux/2.6.31-20-generic; KDE/4.3.5; i686; ; )

On Friday 26 February 2010 21:45:58 you wrote:
> On 25 February 2010 17:50, Reinhold Kainhofer <address@hidden> 
wrote:
> > It must be a very simple, stupid error in my code, but I'm simply unable
> > to locate it. Here is my current patch (relativ to origin/master):
> >    http://codereview.appspot.com/224052
> 
> Wow, that's a great engraver description, Reinhold.  It'd be useful to
> have that kind of detail in some of the other engravers.

absolutely, it's quite hard to understand the details of an engraver without 
proper documentation. It took me really long to understand the old logic 
(resetting figures, leaving them empty, inserting new figures into empty spots 
even if they are "wrong", looping through the array and checking which figures 
are new, no longer existing, continued etc.) The old code was absolutely not 
straightforward to understand, and apparently I was missing one subtle but 
extremely important thing.

> > Does anyone spot the error? Or can anyone enlighten me how exactly the
> > vertical ordering of the figures happens?
> 
> + // We haven't found a continued figure, so append this event as a new
>  figure:
> 
> This creates a new BassFigureLine; as far as I can see, each new
> BassFigureLine added to the alignment spanner is automatically stacked
> above/below (depending on 'stacking-direction) the previous element in
> the grob array.

I was aware of this, but your remark below made me realize my mistake: I 
wondered why the old engraver placed new figures at the top, while my 
implementation (which I thought did basically the same) placed them at the 
bottom... What I missed was that the BassFigureLine spanners of ended 
extenders are NOT deleted, but rather re-used for new figures. In my eyes, this 
vertical alignment should not be done in the engraver itself, but rather be 
left to the alignment spanner. Lines can't be properly reused anyway, since 
new lines should be inserted, whicwill not necessarily affect previous 
positioning (but it can, like in the examples below)

So, my problem now boils down how to insert objects into the vertical 
alignment spanner at arbitrary positions. I can't see any method to achieve 
this. Whether I reuse existing line spanners or create new spanners does not 
make a difference, since it can happen at any time that a new figure should be 
placed between two existing extenders or that a new figure should be added at 
the top or bottom.

E.g.
\figuremode { <4> <7 4 2> } % new at the top and bottom of extender

\figuremode { <6 3> <6 4 3> } % new between two spanners 


> Then you'd
> also need to reorder the grob-array to ensure BassFigureLines which
> should be positioned closer the stave come first (or only add all the
> lines to the alignment spanner once correct ordering is known, which
> probably means waiting until announce_end_grob () is called for a
> BassFigureAlignment).

Hmm, if there is a way to insert new grobs into arbitrary positions, e.g. 
before (above/below depending on the stacking order) a given already inserted 
grob / spanner?

> At the second timestep, the engraver should add the 4 as a
> continuation, then work out that the 5 and 8 are higher, slotting the
> 5 into the existing group created for the 6 and creating a new group
> for the 8.  Then the BassFigureLines should be added to the alignment
> spanner, starting with the 8 to ensure it's the first line in the
> stack.

I don't think reusing is really possible. In particular, in the following 
snippet, if you reuse existing lines, the first figure will be placed too high:

<9 2> <8 3> <8 5 3>

When you reuse line spanners, the 9 and the 8 will share a line, just like the 
2 and the 3. Now in the third figure, a 5 is inserted between the spanners for 
the 8 and the 3, which will then also pull the 9 and the 2 apart... So, the 9 
and the 8 should be aligned independently.

Cheers,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * Edition Kainhofer Music Publishing, http://www.edition-kainhofer.com/
 * LilyPond music typesetting software, http://www.lilypond.org/




reply via email to

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