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 "Mark C. Allman" <mc...@allmanpc.com> on 2003/02/04 19:48:33 UTC
Changes to maintenance release to support fo:marker
Attached is the "cvs diff" for all 22 files changed. Also attached (in
the zip file) is a test XSLFO file (mca.fo) and a pdf output run with my
modified code. The test files are in a zip file since they'd be too
large (together) to send (mailer-daemon limits to 100k).
Notes on the changes:
These files just have a "mayContainMarker()" method added:
src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/fo/flow/TableAndCaption.java
src/org/apache/fop/fo/flow/TableBody.java
src/org/apache/fop/fo/flow/TableCaption.java
src/org/apache/fop/fo/flow/TableCell.java
src/org/apache/fop/fo/flow/TableFooter.java
src/org/apache/fop/fo/flow/TableHeader.java
src/org/apache/fop/fo/flow/ListItem.java
src/org/apache/fop/fo/flow/ListItemLabel.java
src/org/apache/fop/fo/flow/ListItemBody.java
src/org/apache/fop/fo/flow/ListBlock.java
src/org/apache/fop/fo/flow/Inline.java
src/org/apache/fop/fo/flow/Flow.java
src/org/apache/fop/fo/flow/Block.java
src/org/apache/fop/fo/flow/BidiOverride.java
For src/org/apache/fop/fo/flow/RetrieveMarker.java
1. I cleaned the layout() method a bit. Just efficiencies--no bug
fixes.
2. Deleted the "locatePreviousPage()" method. Again, just an
efficiency edit.
3. In the "searchPage()" method I relaxed the search on the current
page for
the desired marker. Please correct me if I'm wrong, but the spec
appears
to say the "is-first" and "is-last" positional attributes are
preferences
and not exclusionary. So for example if we can't find a marker
that's
first but we can find the marker somewhere else on the page then
return what
we can, not "null/not found." I believe that's what the XSLFO spec
intends
but I could very well be wrong.
For src/org/apache/fop/fo/flow/Marker.java
1. Removed the method "mayPrecedeMarker()" since it is no longer used.
If
markers can contain markers (and it doesn't appear that they can)
then we
need to add a "mayContainMarker() {return true;}" method.
For src/org/apache/fop/fo/flow/AbstractTableBody.java
1. In the loop in the "layaout()" method where we process all child
nodes I
added a test for marker children. If the child node is a marker
just call
its layout method and continue to the next child node.
For src/org/apache/fop/apps/StreamRenderer.java
1. We need to keep a list of all pages. If a marker is referenced on a
later
page we need to be able to retrieve the marker value. We were
using the
page queue for this but as pages are rendered they're removed from
the
queue--not good if that removes a page with a marker we'll need
later. So
I added an ArrayList called "pagesList" to hold this list. This
might need
to be optimized to only save markers from previous pages but we also
need to
know things like page sequence so for now just save the entire page.
2. In the "queuePage()" method we also add the page to our list of
pages with
markers if the page has markers (obviously...).
3. In the "getPreviousPage()" method we switch from using the queued
pages list
to the "pagesWithMarkersList" list.
For src/org/apache/fop/fo/FObj.java
1. Added a method "addChild()" which checks if the child node to be
added is
a marker, and if it is checks that it can be added.
2. Cleaned up and added a javadoc header for the method "addMarker()."
Just an
efficiency change--no bug fix.
For src/org/apache/fop/fo/FONode.java
1. This is the base class where we defined the "mayContainMarker()"
method.
The inherited behavior for all nodes is "cannot contain markers,"
or "false."
Any node which can have markers as its initial children overrides
this to
return "true."
for src/org/apache/fop/fo/FOText.java
1. Commented out the "mayPrecedeMarker()" method, since it's no longer
used.
I didn't delete it because I want to keep it around just in case. I
still
need a test case which involves both Markers and FOText nodes.
Comments, criticisms, and feedback are encouraged.
-- Mark C. Allman
-- Allman Professional Consulting, Inc.
-- www.allmanpc.com <http://www.allmanpc.com/> , 617-947-4263
Re: Changes to maintenance release to support fo:marker
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Ok, I worked on the patch. Some notes:
Mark C. Allman wrote:
> These files just have a "mayContainMarker()" method added:
I don't understand the advantage of this. Checks for
proper FO structure are flaky anyway. You also canned
the check that a marker can be preceded by whitespace.
This is actually important.
> 3. In the "searchPage()" method I relaxed the search on the current
> page for the desired marker. Please correct me if I'm wrong, but the spec
> appears to say the "is-first" and "is-last" positional attributes are
> preferences and not exclusionary. So for example if we can't find a marker
> that's first but we can find the marker somewhere else on the page then
> return what we can, not "null/not found." I believe that's what the XSLFO spec
> intends but I could very well be wrong.
I left this as is was, because this is what people currently
use an nobody complained yet. I'll look at it again if I'm
going to implement first-including-carryover and
last-ending-within-page.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Changes to maintenance release to support fo:marker
Posted by Christian Geisert <ch...@isu-gmbh.de>.
J.Pietschmann wrote:
> Christian Geisert wrote:
>
>> Thanks for contribution but as I'm planing to do the 0.20.5 release
>> tomorrow (really ;-) it's just to late for it.
>
>
> I want to take a closer look at this:
Ok?
>>> 1. We need to keep a list of all pages. If a marker is referenced on a
[..]
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Changes to maintenance release to support fo:marker
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Christian Geisert wrote:
> Thanks for contribution but as I'm planing to do the 0.20.5 release
> tomorrow (really ;-) it's just to late for it.
I want to take a closer look at this:
>> 1. We need to keep a list of all pages. If a marker is referenced on a
>> later page we need to be able to retrieve the marker value. We were
>> using the page queue for this but as pages are rendered they're removed from
>> the queue--not good if that removes a page with a marker we'll need
>> later. So I added an ArrayList called "pagesList" to hold this list. This
>> might need to be optimized to only save markers from previous pages but we also
>> need to know things like page sequence so for now just save the entire page.
It is not necessary to store the whole page, we need just the
marker list. A page eats *lots* of memory. This is the disadvantage
of the current approach (which works perfectly well if you put a
<fo:page-number-citation ref-id="does-not-exist"/>
somewhere on the first page where it doesn't screw the layout
completely).
In order to cater for the retrieving scopes, nested lists have to be
used:
page-sequence-list
+- page-list
+- marker-list
This structure is preferably built in queuePage().
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Changes to maintenance release to support fo:marker
Posted by Christian Geisert <ch...@isu-gmbh.de>.
Mark C. Allman wrote:
> Attached is the “cvs diff” for all 22 files changed. Also attached (in
[..]
> Comments, criticisms, and feedback are encouraged.
Thanks for contribution but as I'm planing to do the 0.20.5 release
tomorrow (really ;-) it's just to late for it.
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org