On Sat, Oct 2, 2010 at 8:08 PM, <carl.d.soren...@gmail.com> wrote:

> On 2010/10/03 02:49:30, Mark Polesky wrote:
>
>> On 2010/10/02 16:32:06, Carl wrote:
>> > When laying out a page, LilyPond makes a stack of the
>> > layout items (staves, lyrics lines, chordnames, etc.)
>> > on the page, with a variable spacing item between each
>> > pair of layout items.  When calculating the desired
>> > location of each layout item, the code treats the page
>> > as if the layout items were rigid blocks and the
>> > spacing items were springs, and the whole assembly of
>> > blocks and springs is made to fit in the space of the
>> > page.  In order to make it fit, the springs will be
>> > stretched or compressed.
>> >
>> > The spacing variables affect the size and strength of
>> > the springs, as well as the size of the rigid blocks.
>> > 'padding is added to the rigid block above.  'space
>> > determines the size of the spring -- it's the space
>> > that would be used if no squeezing or stretching would
>> > be required to fit the systems together.
>> > 'stretchability determines the strengths of the
>> > springs.  Higher values of 'stretchability make the
>> > spring weaker; lower values of stretchability make the
>> > spring stronger.  'minimum-space is the
>> > shortest-possible length of the spring.  When the
>> > space between the two layout items reaches
>> > 'minimum-space, the two layout items can be placed no
>> > closer together.
>>
>
>  I like this a lot.  But I think it's misleading to say
>> that 'padding is added to the "rigid block" above,
>> because this implies that 'space is measured from the
>> bottom of the 'padding block, whereas 'space should be
>> measured (IIUC) from what I called the "reference
>> point" of the upper item, and when the upper item is a
>> title or markup, that reference point is the lowest
>> point of the title/markup.  So at least in that case,
>> the upper Y-coordinates of 'padding and 'space would
>> be the same.  Is that right?
>>
>
> I don't think so.  I think 'padding is added as a rigid space interval,
> hence my saying that it is added to the layout item above.
>
> 'space should begin below 'padding IIUC.


The attachment point of 'space doesn't depend on 'padding (or
'minimum-distance). If you think in terms of springs, the beginning of one
spring is always glued to the end of the previous one. 'padding and
'minimum-distance are only useful in determining the minimum lengths of the
springs.




 These 2 paragraphs still leave 'stretchability somewhat
> abstract, but this other line from Carl so far is the
> most promising explanation:
>

 penalty = [(proposed actual space) - (space)]/stretchability
>


Trevor pointed out that the absolute value of 'stretchability doesn't
> matter.  It's just that if one space has twice the 'stretchability of
> another, it will be twice as far from the 'space value.  So it's ratios
> of 'stretchability of the different spaces that makes a difference.
>
> However, I think it is possible (although I haven't checked) that lower
> values of stretchability will allow less stretching to try to fit a
> page, because they should raise the penalty value for an equivalent
> amount of stretching.


Trevor is correct here. The page-breaking routines use a simple and fast
heuristic for figuring out where to break pages. All of these spacing
variables are only used for the page-layout (after the page-breaking has
decided where the breaks go).




 I think we're a lot closer to a suitable explanation.
> We still need to go through and agree what the most
> natural "reference points" are, and then make sure the
> code agrees with that.
>


Maybe.  It may be that the most natural reference points aren't easily
> available.
>

The springs are always attached to the (0, 0) coordinate relative to each
staff or markup. That is, each staff or markup draws itself and returns some
stencil. The spacing code just attaches to the (0, 0) coordinate of that
stencil. For staves, it's the middle staff line (unless you fiddle with
line-positions). For markups, it used to be the baseline (I think). As long
as the various drawing routines can be altered so that the stencil is drawn
relative to its "most natural" reference point, then the spacing code will
handle it.


> I think we should document what we have, and make enhancement requests
> for what we would *like* to have.  I don't think the exercise of "write
> the documents for what we wish we had and then change the code to match"
> is the best way to proceed.  But if Joe's ok with it, then my opinion is
> irrelevant.
>

I don't have a strong opinion on this point. If you want to document the
desired behaviour and add a critical issue, I'll probably be able to fix it
in a reasonable time frame.

Cheers,
Joe
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to