On 27.09.2005 16:38:23 Luca Furini wrote: > Jeremias Maerki wrote: > > > It's an interesting idea. However, I suspect this will probably not be > > necessary. We should be able to make the breaker clever enough to handle > > this particular case. > > When the page bpd depends on the page-masters, things becomes very > strange. Not only it's difficult to implement the page-master choice, but > even to understand what should be the expected result! :-) > > For example: let's suppose the breaker is working, and it has to place the > last 25 lines of a page-sequence. The page-master for the last page has a > bpd allowing no more than 20 lines, while the other page-masters can > contain up to 30 lines. > > What happens? If the breaker starts building a "last page" it soon > realizes that it would not contain all the remaining content, so it would > be no more a "last page". But if it starts building a "non-last page", it > reaches the end of the content, and has to turn it into a "last page", > which is impossible. > > What is the expected output?
In this case it has to generate a blank page IMO. Note that this is a scenario that is important for Switzerland where we have "Einzahlungsscheine" (a preprinted form used for payments). These are often expected to be on the last page of the document. So far I always had to persuade my clients that putting the "Einzahlungsschein" on the first page is not so bad. :-) The problem is with the "page x of y" hack that won't work like this if the last empty block ends up on the second-to-last page. > The only way I see to satisfy the property is > to create two more pages: one "non-last" page, partially empty, with less > than 25 lines (24 or fewer, if there are keeps, widows or orphans) and a > last page with the remaining lines. That sounds suboptimal. The less breaks, the better. Better have a blank page. > This sort of problems happens only if the last page is smaller than the > previous ones: otherwise, the breaker can always try to build a non-last > page, eventually moving all its content into a last page. > > Now I think of this ... an idea, that could work at least when the > non-last pages have the same bpd and the last page a smaller one, could be > to modify a little the elements appended at the end of the sequence, so > that they have a width equal to the difference (nonLastBPD - lastBPD). > This way, the last page created by the breaker will have an apparent width > of nonLastBPD, but the content placed inside it will have an overall bpd > equal to > nonLastBPD - (nonLastBPD - lastBPD) > = lastBPD > > What do you think? I don't get it, yet. What about the following approach? Run the breaker without special last-page handling, then inspect the allocated BPD for the last part. If it fits into the last page, just exchange the page-master (*) and paint it there. If it doesn't fit, paint it using the non-last page-master and add a blank page with the last page-master. If there's a box w=0 at the end of the element list, force a new part and paint that on the last page to handle the "page x of y" case. (*) Doesn't work if the available IPD is different. A restart will be necessary in this case which could result in an overflow of the last page which means that the content can still be reset to the old page-master and a blank last page has to be generated. Jeremias Maerki