lilypond-devel
[Top][All Lists]
Advanced

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

Re: Getting the height of a system.


From: Joe Neeman
Subject: Re: Getting the height of a system.
Date: Mon, 15 May 2006 22:54:09 +1000

On Mon, 2006-05-15 at 12:20 +0200, Han-Wen Nienhuys wrote:
> Joe Neeman schreef:
> > There is actually another possibility that I've only just thought of so 
> > it's 
> > pretty half-baked:
> > Add an approximate-Y-extent to each grob that
> > 1) leaves the grob constant (in particular no caching)
> > 2) ignores anything in the object_alist_ that doesn't have a system.
> > 
> > Then we could even get away with not doing any break-substitutions (until 
> > it's 
> > time to typeset things, of course) with something like:
> > Real System::guess_line_height (Column_x_positions col)
> > {
> >     set_bound (LEFT, col.cols_[0]);
> >     set_bound (RIGHT, col.cols_.back ());
> >     for (vsize i = 0; i < col.cols_.size (); i++)
> >     {
> >             // translate axis (as in System::break_into_pieces)
> >             col.cols_[i].system_ = this;
> >     }
> >     set_loose_columns (this, &col);
> >     SCM h = this->get_property ("approximate-Y-extent");
> >     for (vsize i = 0; i < col.cols_.size (); i++)
> >     {
> >             // translate the axis back
> >             col.cols_.system_ = 0;
> >     }
> >     return scm_to_double (h);
> > }
> > 
> > That is, we can pretend we're working on the original system and get away 
> > with 
> > it because approximate-Y-extent will be guaranteed not to leave any 
> > side-effects. Condition (2) means that we can get away with doing it a 
> > system 
> > at a time. A spanner that crosses a line break will realise that it is 
> > crossing the line break and will try to provide a sensible guess.
> 
> I think that's a sensible stop gap solution, but I have a feeling it 
> will be a lot of work. Perhaps it's better to approach from the other 
> side, and only explicitly do this for alignment spanners.
> 
> Perhaps you could even compute for each VerticalAxisGroup the range of 
> column ranks where it would disappear, and use that information add a 
> method to compute the approximate height of an alignment spanner, where 
> you explicitly call it with a (begin,end) pair of column ranks.
> 
> In that case, you could get the approximate height of one broken system 
> in logarithmic time.

That sounds encouraging! I don't fully understand how alignment spanners
work since I haven't had much to do with that part of the code (yet).
But this looks like something I can go on with -- I'll be back if/when
I've made something useful out of it.




reply via email to

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