On Oct 2, 2007, at 18:47, Andreas L Delmelle wrote:
On Oct 2, 2007, at 12:27, Chris Bowditch wrote:
Hmm. I tend to agree with Simon's perspective here. The terms
"total-fit" and "best-fit" refer to the implementation of the
algorithms. Surely the end result of the total-fit algorithm is
the same thing as the algorithm itself? The user expectation of
total-fit may well be what you describe, but I'm not sure how it
could be achieved using the algorithms themselves.
<snip />
Also, my expression of "multiple best-fits" should actually be
"multiple total-fits".
As in: There will always be some sort of threshold, like a certain
amount of content that can be fit onto, say, the first three pages.
Once this threshold is known, running a total-fit algorithm over
the elements up to that point, and continuing from the next should
lead to *exactly* the same result as a global (uninterrupted) total-
fit.
Just thought of it this way:
Instead of collecting all the ListElements for the whole page-
sequence in one massive recursive iteration as is the case now
(getNextKnuthElements()), maybe the algorithm can be 'slightly'
altered in such a way that the FlowLM repeatedly checks back with the
PageSequenceLM and updates the LayoutContext for the active page.
Not: collect *all* lines/paragraphs first, and only then *all* pages
(may be "total-fit", I'm not sure I would call it that...).
But rather, an incremental total-fit:
while (moreContent) {
collect more lines
if (accumulated line-height causes an implicit but unavoidable
page-break) {
run page-breaking algorithm over the accumulated lines
}
}
Obviously, the if-test is only a very rough estimation, but a good
one, since it guarantees that the sequence always generates at least
one page-break (no space-resolution, footnotes, floats taken into
account here yet)
That would provide our 'interference' point, where decisions can be
made about whether to continue accumulating layout-possibilities or
interrupt, start adding areas based upon the best possibility so far,
and resume, but with a cleared state. The head of the list of lines/
pages will be chopped off, and their possibilities need no longer be
considered.
If I interpret correctly, the node corresponding to the 'best'
overall break for the first line/page (the one chosen by a total-fit
implementation), in many cases can be determined quite early in the
process. You don't always need to look at all words/lines in the
paragraph/page-sequence for that.
Andreas