bug-lilypond
[Top][All Lists]
Advanced

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

Re: Lyrics break estimation of vertical spacing


From: Joe Neeman
Subject: Re: Lyrics break estimation of vertical spacing
Date: Mon, 29 Mar 2010 18:48:27 -0700

On Mon, 2010-03-29 at 20:49 -0400, Boris Shingarov wrote:
> > I'd rather discuss this point now, because I don't like the extension of
>   > Interval (and I'd rather you didn't spend a whole lot of time getting it
>   > to work if there is a nicer way)
>  
> No kidding, neither do I like diluting Interval.  One, it is an extremely
> hacky way to do things.  Two, it *does* introduce problems all over the
> rest of the code: various idiosyncrasies of C   showing up here and
> there, ending up having a donzen of different places fixed already, but
> no one knows how many more will surface.  A situation definitely NOT
> to be happy about. 
> 
> > Replace constrained-breaking.cc:461 by
>   >
>   > Interval begin_extent = sys->begin_of_line_extent (start, end);
>   > Interval rest_extent = sys->rest_of_line_extent (start, end);
>  
> Yes, but how do I implement begin_of_line_extent()?
> Grob::pure_height() simply looks up the value of the "Y-extent" property,
> which is a Scheme function, and applies it.  The problem that I've been
> struggling with during the past several days, is that this is generic. 
>  
> Oh wait.  Are you saying that System has Axis_group_interface?
Yes.

> So that I can call Axis_group_interface::*_of_line_pure_height() on it?
> Let me try it right now. 

No, because *_of_line_pure_height only works properly for
VerticalAxisGroup. What you'll need to do is to write
System:*_of_line_pure_height. For example (typed directly into my mail
client, so it probably won't even compile):

Interval
System::begin_of_line_pure_height(Grob *me, vsize start, vsize end)
{
  System *sys = dynamic_cast<System*> (me);
  Grob *alignment = me->get_vertical_alignment (); // check for null
  extract_grob_set (alignment, "elements", staves);
  vector<Real> offsets = Align_interface::get_minimum_translations (alignment, 
staves, Y_AXIS, true, start, end);

  Interval ret;
  for (vsize i = 0; i < staves.size(); ++i)
    {
      Interval iv = Axis_group_interface::begin_of_line_pure_height(staves[i], 
start);
      iv.translate (offsets[i]);
      ret.unite (iv);
    }
  return ret;
}

For more code reuse, it might be better to write one function which
computes both begin_of_line_ and rest_of_line_pure_height.

Cheers,
Joe






reply via email to

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