You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Luca Furini <lf...@cs.unibo.it> on 2004/10/25 17:47:09 UTC
Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr
LineLayoutManager.java
Jeremias Maerki wrote:
> jeremias 2004/10/10 04:21:29
>
> Modified: src/java/org/apache/fop/layoutmgr LineLayoutManager.java
> Log:
> This is supposed to fix a problem that surfaced with Finn's latest
> change in PageSequence. There was an ArrayIndexOutOfBoundsException here in
> LineLayoutManager when a static region was layouted for the second page
> (instance is reused). It seems to me that "iCurrParIndex" could be made a
> method-local variable instead of an instance variable.
It took me a while to notice that these changes cause another problem for
blocks containing preserved linefeeds and whose lines are parted on
different pages. For these blocks, the array named knuthParagraphs has
more than one element (the block will generate more than one paragraph)
and the method LineLM.addAreas() is called more than once, so it isn't
always right to set iCurrParIndex to 0. I'm attaching a fo file showing
this problem.
So, iCurrParIndex must be set to 0 in addAreas only for LineLM descendant
of a StaticContentLM.
But maybe it isn't necessary to call addAreas more than once for static
content: as the static content is repeated on each page, wouldn't it be
better to store the static area sub-tree and re-use it?
Regards,
Luca
Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr LineLayoutManager.java
Posted by Jeremias Maerki <de...@greenmail.ch>.
That's exactly why we need a good regression test facility. I apologize
for not being more thorough. I'll probably have time on Thursday to look
into it if noone beats me to it.
I also thought about reusing the static areas but as soon as there are
things like the page number or another reference, things get complicated.
I don't think it's worth the trouble to write code that can detect if a
static area is invariable.
On 25.10.2004 17:47:09 Luca Furini wrote:
> Jeremias Maerki wrote:
>
> > jeremias 2004/10/10 04:21:29
> >
> > Modified: src/java/org/apache/fop/layoutmgr LineLayoutManager.java
> > Log:
> > This is supposed to fix a problem that surfaced with Finn's latest
> > change in PageSequence. There was an ArrayIndexOutOfBoundsException here in
> > LineLayoutManager when a static region was layouted for the second page
> > (instance is reused). It seems to me that "iCurrParIndex" could be made a
> > method-local variable instead of an instance variable.
>
> It took me a while to notice that these changes cause another problem for
> blocks containing preserved linefeeds and whose lines are parted on
> different pages. For these blocks, the array named knuthParagraphs has
> more than one element (the block will generate more than one paragraph)
> and the method LineLM.addAreas() is called more than once, so it isn't
> always right to set iCurrParIndex to 0. I'm attaching a fo file showing
> this problem.
>
> So, iCurrParIndex must be set to 0 in addAreas only for LineLM descendant
> of a StaticContentLM.
> But maybe it isn't necessary to call addAreas more than once for static
> content: as the static content is repeated on each page, wouldn't it be
> better to store the static area sub-tree and re-use it?
Jeremias Maerki