Jeremias Maerki [Tue, 14 Feb 2006 10:02:11 +0000 (10:02 +0000)]
Attaching the ImageFactory to the FopFactory. To have a cache effect between multiple rendering runs the FopFactory would have to be reused after this change. Multiple FopFactories = Multiple image caches.
Jeremias Maerki [Fri, 10 Feb 2006 14:39:34 +0000 (14:39 +0000)]
Creation of Font instances centralized in FontInfo and added a cache for them. This removes duplicate code in a number of places, improves speed a little and saves memory.
Jeremias Maerki [Thu, 9 Feb 2006 13:48:48 +0000 (13:48 +0000)]
Reworked area building in AreaTreeParser to match the scheme that the FOTreeBuilder uses. Cuts away another 10-15% processing time. Too many String.equals() calls and a minor optimization in setTraits().
Jeremias Maerki [Thu, 9 Feb 2006 08:54:06 +0000 (08:54 +0000)]
Bugfix: padding-top and padding-bottom on list-items could lead to wrong page break decisions and thus to overlapping text.
Bugfix: break-before and break-after were ignored on list-items.
Jeremias Maerki [Wed, 8 Feb 2006 15:42:03 +0000 (15:42 +0000)]
Added missing values in area tree XML for PageViewport (simple-page-master-name and blank).
Performance improvement of about 10% for a simple document inside the AreaTreeParser (Hotspot: setTraits())
Changed the way that trait info lookup is done in Trait.java. Should be just a little faster now.
Unused traits disabled.
Commented unused methods.
Jeremias Maerki [Tue, 7 Feb 2006 14:18:38 +0000 (14:18 +0000)]
Non-SVG XML got loaded into a non-namespace-aware node which caused problems later when serializing the foreign XML to the intermediate format. Fixes a problem with serializing barcodes (Barcode4J) to the intermediate format.
Jeremias Maerki [Thu, 2 Feb 2006 16:20:22 +0000 (16:20 +0000)]
Bugzilla #38453:
Bugfix: Text-decoration was not promoted if no text-decoration attribute was specified on a nested element.
Nice side-effect: more efficient evaluation of text-decoration.
Simon Pepping [Sat, 28 Jan 2006 15:57:59 +0000 (15:57 +0000)]
An addition to FOP that can be used to render a hyphenation tree in
various ways, among which a complete tree representation. And
correction of a few typos in HyphenationTree.
Jeremias Maerki [Fri, 27 Jan 2006 15:34:10 +0000 (15:34 +0000)]
Added safe-guard against reuse to avoid problems with the renderers.
Removed reset() method. Compared to the many hundred object instances that get created by the FO tree and layout engine, the Fop and FOTreeBuilder instance are negligible. Better keep the API as simple as possible and create an environmental class in the long run.
Jeremias Maerki [Wed, 25 Jan 2006 21:16:26 +0000 (21:16 +0000)]
Bugzilla #37506:
Extracted a base class for both PFMReader and TTFReader to remove duplicate code.
Submitted by: Kev Jackson <kevin.jackson.at.it.fts-vn.com>
(Patch applied with changes: escape method removed, tabs removed, javadocs added)
Jeremias Maerki [Tue, 24 Jan 2006 20:02:30 +0000 (20:02 +0000)]
Following the model of Graphics2DAdapter, added a new interface ImageAdapter which can optionally be implemented by Renderers to support painting of RenderedImage or BufferedImage instances from inside XMLHandler implementations. First implementation by the PSRenderer. Barcode4J is going to be extended to use this interface so barcode support can easily be added to the AFP Renderer without having a Graphics2D implementation at first.
Jeremias Maerki [Tue, 24 Jan 2006 14:21:46 +0000 (14:21 +0000)]
Command-line support for the intermediate format: Use "-atin" to specify an area tree XML file.
Refactoring of the InputHandler to accomodate the IF as input format and to make responsibilities clearer in general.
Jeremias Maerki [Tue, 24 Jan 2006 13:45:56 +0000 (13:45 +0000)]
Bugfix: LineArea used a private field instead of the start-indent trait which caused problems for centered and right-aligned text when rendering is done from the intermediate format. The AreaTreeParser parses and sets the trait but not the startIndent field on LineArea, so I removed the startIndent field.
Jeremias Maerki [Fri, 20 Jan 2006 13:09:05 +0000 (13:09 +0000)]
(Re?)added integer page number to the PageViewport.
Serializing both the integer and the formatted value to the area tree XML. In the XML "nr" is now "formatted-nr" and "nr" is now the integer value. This doesn't have any impact on our layout engine tests as we don't seem to use a non-default for page numbers.
Make the current PageViewport available to XMLHandler through the RenderContext.
I need this for Barcode4J so the current page number can be used as part of a barcode message.
Jeremias Maerki [Thu, 19 Jan 2006 15:10:14 +0000 (15:10 +0000)]
Following a clarification by the XSL FO SG, space traits are only set on the first and last area generated by an FO, and not on every area anymore.
For details, see: http://wiki.apache.org/xmlgraphics-fop/XslFoSpecificationUncertainties/SpaceTraits
Note: this change brings another issue in column balancing to light. That's the reason for disabling one of the tests. I wasn't able to find a quick fix there.
Jeremias Maerki [Thu, 19 Jan 2006 09:46:44 +0000 (09:46 +0000)]
New interface XMLizable (copied from Apache Excalibur) to mark classes that can serialize themselves to XML (SAX stream).
New interface ContentHandlerFactory (plus associated Factory with Service discovery) for sub-document parsing plug-ins. Used by the area tree but could be used independently.
ExtensionAttachments are now part of the area tree and are written by XMLRenderer and parsed by AreaTreeParser.
The PS Extensions are extended to support serialization to and deserialization from XML.
Added a test case that tests the PS Extension WRT the handling in the area tree XML.
Jeremias Maerki [Tue, 17 Jan 2006 11:07:10 +0000 (11:07 +0000)]
New feature: "Intermediate format" (IF). The IF is basically the XML dialect written by the area tree renderer (XMLRenderer). A new parser for this format allows reparsing a serialized and possibly modified area tree and rendering it to the final target format. More details on the Wiki at http://wiki.apache.org/xmlgraphics-fop/AreaTreeIntermediateXml. No advanced features have been implemented, yet, only the basic functionality. The whole change should be fully backwards-compatible WRT the outer FOP API except maybe for FOTreeBuilder.addElementMapping(), and the area tree XML which got small changes.
The area tree has been cleaned up. The serializability has been restored. The CachedRenderPagesModel works again and can, in certain situations, decrease the maximum amount of memory held at one point in time. Some adjustments were necessary in the area tree to help the work of the AreaTreeParser.
The AreaTreeParser is new and is responsible for parsing area tree XML files and adding pages to a RenderPagesModel instance. It is SAX-based and should be pretty efficient.
XMLUnit (http://xmlunit.sourceforge.net, BSD license) is a new dependency for the test code. It is used to verify the correctness of the intermediate format code. It doesn't have to be installed for the build to run through, though.
ElementMapping got a new method getDOMImplementation() which provides the DOMImplementation used to handle a subdocument of a particular namespace. For example, SVG uses Batik's SVG DOM. The AreaTreeParser needs that to properly recreate foreign objects because it can't use the mechanism of the FO tree. The default implementation returns null.
The ElementMapping instances are no longer maintained by the FOTreeBuilder, but by the newly created ElementMappingRegistry class. It is expected that the instance of this class is moved from the FOTreeBuilder and the AreaTreeParser's Handler class to the "environment class" once it is created to cut down on the startup time for each processed document.
The XMLRenderer has been slightly modified to improve the serialization/deserialization qualities of the area tree XML format.
The XMLRenderer can now mimic another renderer (see mimicRenderer(Renderer)) in order to use its font setup. That way it is made certain that the reparsed area tree will render to the final target format exactly as expected.
Fixed a bug in the XMLHandlerRegistry which did not always return the right XMLHandler for every situation.
Added a DefaultErrorListener to the util package. I've had problems with Xalan-J swallowing exceptions with its default ErrorListener, so I added a simple one for convenience and use in AreaTreeParser.
Example code for working with the AreaTreeParser can be found in examples/embedding. Documentation will follow.
Jeremias Maerki [Mon, 16 Jan 2006 09:18:11 +0000 (09:18 +0000)]
Bugfix: Floating point numbers were not properly formatted in the PDF renderer which could lead to error messages while opening a PDF in Acrobat Reader.
Simon Pepping [Tue, 10 Jan 2006 20:18:13 +0000 (20:18 +0000)]
The last page sequence should also follow its force-page-count trait.
Replace one test case with two leaner test cases, submitted by Gerhard
Oettl, see bug 38087.
Jeremias Maerki [Tue, 10 Jan 2006 13:19:54 +0000 (13:19 +0000)]
Fixed ugly NPE (with no message) when a malconfigured font was processed by the PS Renderer (even when that font is not used). When the font is used we don't get an NPE anymore but a Runtime exception. Not ideal, but a little better, especially because of the error message. I hope that at some point someone finds time to clean up the whole exception handling in FOP.