[Luca on space resolution]

So, my idea for handling space resolution is tho have a LM ask its children about their spaces, and create the necessary elements (while at the moment each LM creates elements for its own spaces).

For example, if we have this LM tree

           Outer BlockLM
                 |
    +------------+------------+
    |            |            |
BlockLM 1    BlockLM 2    BlockLM 3
                 |
          +------+-----+
          |            |
      BlockLM A    BlockLM B

BlockLM1.getNextKnuthElements() would return to the outer BlockLM only the elements representing its block content, without any space.

In order to decide which elements it has to create, the outer BlockLM could have some lines like:

(currentChild = BlockLM 1
 nextChild = BlockLM 2)

space1 = currentChild.getSpaceAfter();
space2 = nextChild.getSpaceBefore();
if (this.mustKeepTogether()
    || currentChild.mustKeepWithNext() && !nextChild.hasBreakBefore()
    || !currentChild.hasBreakAfter() && nextChild.mustKeepWithPrevious) {
    // there cannot be a break between the two children,
    createElementsForSpace(resolve(space1, space2, false, false));

Surely there is a possible break here. It just have a very high penalty, but even keep-*="always" is allowed to break.

regards,
finn

Reply via email to