On Thu, Jan 17, 2008 at 12:27:11AM +0100, Andreas L Delmelle wrote:
> Right now, the element list is constructed as the result of recursive calls 
> to getNextChildLM.getNextKnuthElements().
> /The/ return list upon which the page breaker operates is the one that is 
> ultimately returned by the FlowLM.
>
> Instead of that, I've been thinking in the direction of making it a data 
> structure that exists 'physically' separate from the LMs.
> This structure, created and maintained by the PageSequenceLM, would be 
> passed down into an appendNextKnuthElementsTo() method.
>
> The lower-level LMs can signal an interrupt to the ancestor LMs, based on 
> information they get through the LayoutContext --forced breaks being the 
> most prominent.
> The FlowLM, instead of simply continuing the loop, could give control back 
> to the PageSequenceLM, which can run the page breaker over the list up to 
> that point.

I would rather pass a reference to the page breaker in the
getNextKnuthElements call. Each LM can then append Knuth elements in a
callback to the pagebreaker. At each such append callback, the page
breaker can decide to run the Knuth algorithm and ship pages. When
this callback finishes, the LM can continue. Running the Knuth
algorithm intermittently makes no sense in a total-fit algorithm.

> We would also need to be able to determine the likelihood of the computed 
> page-breaks changing due to additional content, if the FlowLM stil has 
> childLMs coming up.

The Knuth algorithm does not determine actual pagebreaks but feasible
pagebreaks. Feasible pagebreaks are only determined by the preceding
Knuth sequence. Following Knuth elements can contribute more feasible
pagebreaks, but they can not change already determined feasible
pagebreaks. Only at the appropriate time is the best feasible
pagebreak selected, and are the actual pagebreaks determined. The
appropriate time is the end of the sequence in a total-fit
strategy. In the best-fit strategy it is the point where no further
feasible pagebreaks for the current page can be contributed.

The Knuth algorithm now performs a loop over all Knuth elements. This
loop can be made interruptible, provided the state is preserved. This
property makes it possible to run the Knuth algorithm intermittently.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Reply via email to