Created attachment 28708 [details] Code changes applied including a test case A new dependency to Mockito has been added for the test case
PostScript documents are by default drawn from the bottom up, because of this FOP changes the Y axis for each generated PS file so everything on the page is inverted and can be displayed in the same way as other document types such as PDF. If however, an SVG drawing co-ordinates were specified from the top down, a custom transform would need to be applied to counter FOP's automatic switch. The problem was that a checkTransform method prevented any new transform matching the current page transform from being applied. This original intention of this checkTransform method was to reduce the number of times the same transform is applied to the postscript file thus reducing its size. This is because if a transform is applied to an SVG drawing, for each shape being drawn the transform is applied at the shape level instead of at a drawing or subsequent svg parent level. Where the checkTransform method fails is that it only checks for one outcome which is the initial page transform which in this case causes the problem. If you change the transform to invert the drawing by one pixel less e.g. [ ... 791 ] instead of [ ... 792 ] the transform would be applied on each shape and it would appear correctly (albeit a little off centre). This is because the transform is applied for the shape and then the graphics state is reverted meaning the current page state is never changed and the only transform it would ever ignore would be one matching the original FOP inversion transform. As such I have removed this method and added a test unit case to prove it is now concatenating the affine transform correctly. The checkTransform method was a good idea, but due to the way Batik, Fop and XGC passing transforms onto child objects this is not currently possible to implement a fix and subsqeuent reduction in PS file sizes.
patch landed at: http://svn.apache.org/viewvc?rev=1333076&view=rev http://svn.apache.org/viewvc?rev=1333077&view=rev thanks rmeyer! please verify and close if satisfied
Thanks for applying this patch Glenn, I added the Hamcrest JAR to which Mockito has a transitive dependency r1333083.
(In reply to comment #4) > Thanks for applying this patch Glenn, I added the Hamcrest JAR to which > Mockito has a transitive dependency r1333083. thanks; i guess the current xgc junit doesn't tickle that dependency since it ran without error after i added mockito and objenesis jars
Yeah, no biggy. Hamcrest is needed for some of the matchers that Mockito uses which Rob hasn't used here.
Thanks for applying the patch. I have verified the changes and will now set the status to closed / fixed.