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.
Manuel Mall [Sat, 7 Jan 2006 13:15:53 +0000 (13:15 +0000)]
Added support for relative font config URLs (metrics-url and embed-url). These URLs are now resolved through the FOP config URI resolver. A new configuration item font-base has been added which defines the base URL to be used for resolution of the font URLs. If it is not given the normal FOP base URL is used. Unrelated to this feature the patch also contains a new image class (java 1.4 specific) for JPEG images. This is for renderers (e.g. AFP) which require access to the decoded JPEG.
Jeremias Maerki [Thu, 5 Jan 2006 10:24:18 +0000 (10:24 +0000)]
Bugzilla #38132:
Bugfix: Certain border styles could lead to a NullPointerException.
inset and groove are now mapped to RTF's "engrave", outset and ridge to "emboss". If no mapping can be found the "solid" style is used. Before null was returned which was the cause for the NPE.
Jeremias Maerki [Wed, 4 Jan 2006 19:30:24 +0000 (19:30 +0000)]
Bugzilla #38102:
Bugfix: Space was not adjusted if the space was on a nested block inside an auto-height block-container. This could lead to content overflowing the bottom of a page.
Note: Tables and lists currently don't offer space adjustments due to the current limits of the element list combination process. Once the stretch/shrink components are handled during element list combination, this will have to be rechecked.
Jeremias Maerki [Tue, 3 Jan 2006 17:35:23 +0000 (17:35 +0000)]
Bugfix: TableCell did not properly report that it generates reference-areas which could lead to wrong inherited values for start-indent and end-indent.
Jeremias Maerki [Tue, 3 Jan 2006 13:08:45 +0000 (13:08 +0000)]
The font loading code now reads the encoding value from the XML font metrics file so that Type 1 fonts like Symbol and ZapfDingbats can be embedded explicitely (Required by PDF/A).
Note that it is necessary to set the encoding value in the font metrics file manually since it cannot be extracted from the PFM file reliably, i.e. for "Symbol" use "SymbolEncoding" and for "ZapfDingbats" use "ZapfDingbatsEncoding".
Manuel Mall [Wed, 28 Dec 2005 03:08:49 +0000 (03:08 +0000)]
LineArea had a finalize method which caused a NPE when called from the garbage collector. I assume it was never intended for this method to be an override of the Java Object finalize method. Renamed the method to finalise.