On 19.06.2006 14:54:06 Luca Furini wrote:
> Manuel Mall wrote:
> > Yes, there is a force parameter and it seems to be always set to true 
> > for page breaking (and false for line breaking). But it doesn't seem to 
> > guarantee that breaks will be found otherwise we shouldn't get 
> > the "giving up after 50 retries" message.
> The "force" parameter requires the algorithm to find a set of breaks, even 
> if some of them could require an adjustment ratio greater than the 
> maximum one, or smaller that -1 (those breaks are represented by the nodes 
> stored in lastTooLong and lastTooShort).
> During the line breaking, it is first set to "false", so that we first try 
> and look for "good" line breaks, and set to false only if the first tries 
> failed, and we need to create some ugly lines (too short or too long, just 
> as underfull and overfull lines in tex).
> The last call to findBreakingPoints (which, for the page breaking, is also 
> the first one) needs to have force = true, as we need to have some breaks 
> to continue (if force == false and the algorithm fails we have no breaks 
> after the end of the method).
> The "overflow recovery" mechanism tries avoiding the use of a "long" break 
> (i.e. one involving some content to overflow the available space), 
> inserting an empty page and trying againg: this works if one of the 
> following pages will be taller.
> This could happen, for example, when we have a block spanning all columns 
> and then some other content that must flow in the columns: due to the 
> presence of the spanning block, the first page will have some short 
> columns, while the following pages could use the whole body height (this 
> example makes me think that 50 attempts could be even too many, but maybe 
> there are other situations where such a large number is really needed).

Good point. 50 is an arbitrary value I chose, just to make sure. :-) It's
pretty unrealistic to expect more than 5 or 10 empty pages before a page
is found with more available BPD.

> Should this strategy not work (for example, we are trying to place a 30cm 
> image inside a 20cm-high body), instead of throwing the exception we could 
> use the lastTooLong node (which always exists), after removing the "empty 
> page" nodes.

Good idea.

Jeremias Maerki

Reply via email to