Re: fop-ttfreader - output bounding box information for characters?
Hi Alexey, On 04/01/2013 19:41, Alexey Neyman wrote: snip/ Interesting workaround. We are trying to tackle this issue by providing an alternative implementation of GVTFont in Batik that uses FOP's Font Library to load the font metrics. First, as I was told on the list previously, it is not a small feat and it would take some time before this fix is released. Yes, that is correct. Then, even though it would solve the issue for SVGs, it won't help with font selection for MathML. As I explained below, JEuclid pre-renders the glyphs into paths. That's true. I missed the fact you were working with JEuclid And as far as I can tell, JEuclid project is all but dead: the last non- trivial commit was 16 months ago, and the last release 30 months ago. I don't think it is likely JEuclid will catch up with FOP improvements, even when they're available. I'm subscribed to the JEuclid mailing list and I get the same impression. This does not work well with JEuclid, though. When JEuclid generates SVG from MathML, it performs font rendering - that is, replaces characters by actual paths. And again, it uses system fonts, not the fonts available in FOP - even if running as FOP plugin. To work around this issue for MathML, I am currently switching from JEuclid to pMML2SVG (http://pmml2svg.sourceforge.net). It generates SVGs with text characters, not paths. But in order to do so, it needs font metrics. Unfortunately, font metrics produced by stock FOP TTFReader are not sufficient - this stylesheet also needs bounding box for each glyph. To obtain these, pMML2SVG currently packages an augmented TTFReader Java sources which are to be compiled and used in lieu of the stock one. Given that the patch is very small and as far as I can tell, compatible with current users of font metrics (it just adds 4 attributes to glyph description), is it possible to integrate this support into stock FOP? Patch from pMML2SVG, slightly modified to apply to FOP 1.1 sources, attached. Thanks for the patch. To get this added to the code base please raise an issue in JIRA, add the diff as an attachment and include [PATCH] in the subject line. A committer will then review the patch before applying it. Created an issue: https://issues.apache.org/jira/browse/FOP-2180 Thank you. I know Peter Hancock is looking into doing something similar as he is working on getting Batik to use FOP configured fonts instead of the system ones. Peter mentioned to me offlist that he was going to need to expose a few extra things in TTFReader to facilitate this, could be you are covering similar ground here. Maybe. Then again, the root of the issue is not Batik - that issue I work around by embedding fonts. It is JEuclid's use of system fonts which is why I am switching to pMML2SVG - which needs bounding box information for glyphs. BTW, another useful feature in pMML2SVG that was not available in JEuclid is that pMML2SVG outputs baseline position information in the generated SVG - so that inline equations can be properly positioned on the line. Sounds like we need a FOP plug-in for pMML2SVG to replace the ageing JEuclid one. Thanks, Chris Regards, Alexey. Anyway, please raise the JIRA issue otherwise your patch could get lost. Thanks, Chris Regards, Alexey. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
RE: FOP-Trunk revision 1428722 unit test fails
Hi, You need extra jars in classpath to run the unit tests. To just build you can use ant package. Some of these might be needed if you want to run tests: # lib/barcode4j-fop-ext.jar # lib/barcode4j.jar # lib/checkstyle-5.5-all.jar # lib/fop-hyph.jar # lib/jacocoagent.jar # lib/jacocoant.jar # lib/jai_imageio.jar # lib/junit-4.10.jar # lib/zxing-core-1.7.jar Thanks -Original Message- From: John Brown [mailto:johnbrown...@hotmail.com] Sent: 04 January 2013 13:43 To: fop-users@xmlgraphics.apache.org Subject: FW: FOP-Trunk revision 1428722 unit test fails Hello All, The following error occurred while building FOP-Trunk 1428722: [junit] Testsuite: org.apache.fop.intermediate.IFTestCase [junit] Tests run: 10, Failures: 0, Errors: 1, Time elapsed: 0.346 sec [junit] [junit] Testcase: runTest[5](org.apache.fop.intermediate.IFTestCase): Caused an ERROR [junit] Expected XPath expression to evaluate to 'true', but got '' (XPath: /descendant::if:text[1]/@hyphenated) [junit] java.lang.RuntimeException: Expected XPath expression to evaluate to 'true', but got '' (XPath: /descendant::if:text[1]/@hyphenated) [junit] at org.apache.fop.layoutengine.EvalCheck.doCheck(EvalCheck.java: 86) [junit] at org.apache.fop.layoutengine.EvalCheck.check(EvalCheck.java:65 ) [junit] at org.apache.fop.intermediate.IFTester.doIFChecks(IFTester.java :80) [junit] at org.apache.fop.intermediate.IFTestCase.runTest(IFTestCase.jav a:103) [junit] [junit] BUILD FAILED C:\Users\John\Downloads\Open_Source\fop-svn\build.xml:820: Tests failed However, it seems to have built fop*.jar. What is the significance of the failed test? Regards, John Brown. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
RE: FOP-Trunk revision 1428722 unit test fails
Simon Steiner wrote: Hi, You need extra jars in classpath to run the unit tests. To just build you can use ant package. Some of these might be needed if you want to run tests: # lib/barcode4j-fop-ext.jar # lib/barcode4j.jar # lib/checkstyle-5.5-all.jar # lib/fop-hyph.jar # lib/jacocoagent.jar # lib/jacocoant.jar # lib/jai_imageio.jar # lib/junit-4.10.jar # lib/zxing-core-1.7.jar Thanks Hello Simon, Of these, I have /path/to/fop-trunk-checkout/build/fop-hyph.jar and /mingw/local/lib/junit-4.8.1.jar (not v 4.10) where /mingw/local is where I installed ant-1.8.4. `ant package' works. Thanks. Regards, John Brown. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
Re: targetrenderer set to MIME_PNG fails in fop =1.0 but succeeds in 0.95
Can you start with the embedding.ExampleFO2PDF.java example (in examples/embedding/java), change the mime type to MIME_PNG (and rename all the PDFs to PNGs) and confirm that the new example does generate a PNG file? I just tested that with trunk and it worked. On 12/27/12 3:02 PM, Milo van der Zee wrote: Dear FOP users, I'm using FOP for a couple of years now and thought it was time to upgrade to version 1.1. Problem is that the rendering to PNG stopped functioning. It all still works with version 0.95. PDF generation is still fine. The difference between PNG and PDF generation is the mime type of fop generated with the factory. Strange thing is that the call to '*userAgent.getRendererOverride()*' returns 'null' in version 1.1 and returned the expected PNGRenderer in version 0.95. Is this a bug or is something changed between versions in relation to PNG rendering? From the debug info I see that the renderer does create a page. It seems like the link between the rendererImpl and the mime-type is not found. But where can I force that? See code fragments below. Thank you very much for any help., Milo van der Zee some relevant code: --- FopFactory fopFactory = FopFactory.newInstance(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setTargetResolution(document.getPreviewDPI()); ByteArrayOutputStream out = new ByteArrayOutputStream(); Fop fop = fopFactory.newFop(*MimeConstants.MIME_PNG*, foUserAgent, out); TransformerFactory factory = TransformerFactory.newInstance(); Source xslfo = DocumentGenerator.generateXslFo(document); Transformer transformer = factory.newTransformer(xslfo); SAXBuilder saxBuilder = new SAXBuilder(); saxBuilder.setErrorHandler(new SaxParserErrorListener()); org.jdom.Document dataDocument = saxBuilder.build(new StringReader(dataString)); DOMSource src = new DOMSource((new DOMOutputter()).output(dataDocument)); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); FOUserAgent userAgent = fop.getUserAgent(); *PNGRenderer renderer = (PNGRenderer)userAgent.getRendererOverride();* --- --- I added this to my pom.xml: --- dependency groupIdorg.apache.xmlgraphics/groupId artifactIdfop/artifactId version${fop-version}/version exclusions !-- FOP has wrong dependancies on the avalon framework -- exclusion groupIdorg.apache.avalon.framework/groupId artifactIdavalon-framework-api/artifactId /exclusion exclusion groupIdorg.apache.avalon.framework/groupId artifactIdavalon-framework-impl/artifactId /exclusion /exclusions /dependency !-- these two are to correct issues in fop dependency -- dependency groupIdavalon-framework/groupId artifactIdavalon-framework-api/artifactId version4.2.0/version /dependency dependency groupIdavalon-framework/groupId artifactIdavalon-framework-impl/artifactId version4.2.0/version /dependency --- --- Some debug info: --- DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.ps.extensions.PSExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.fo.extensions.xmp.XMPContentHandlerFactory DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.txt.TXTRendererMaker DEBUG org.apache.fop.render.RendererFactory - *Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.PNGRendererMaker* DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.TIFFRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.xml.XMLRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.awt.AWTRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.print.PrintRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for FOEventHandler: org.apache.fop.render.rtf.RTFFOEventHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pdf.PDFDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pcl.PCLDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.bitmap.TIFFDocumentHandlerMaker DEBUG
Re: fop-ttfreader - output bounding box information for characters?
Hi Chris, On Monday, January 07, 2013 11:44:46 AM Chris Bowditch wrote: Patch from pMML2SVG, slightly modified to apply to FOP 1.1 sources, attached. Thanks for the patch. To get this added to the code base please raise an issue in JIRA, add the diff as an attachment and include [PATCH] in the subject line. A committer will then review the patch before applying it. Created an issue: https://issues.apache.org/jira/browse/FOP-2180 Thank you. So, can this patch be reviewed/integrated? I know Peter Hancock is looking into doing something similar as he is working on getting Batik to use FOP configured fonts instead of the system ones. Peter mentioned to me offlist that he was going to need to expose a few extra things in TTFReader to facilitate this, could be you are covering similar ground here. Maybe. Then again, the root of the issue is not Batik - that issue I work around by embedding fonts. It is JEuclid's use of system fonts which is why I am switching to pMML2SVG - which needs bounding box information for glyphs. BTW, another useful feature in pMML2SVG that was not available in JEuclid is that pMML2SVG outputs baseline position information in the generated SVG - so that inline equations can be properly positioned on the line. Sounds like we need a FOP plug-in for pMML2SVG to replace the ageing JEuclid one. Pardon my ignorance, but what is FOP using for the XSL transformation? Is it Xalan-based? In that case, it probably won't be sufficient: pMML2SVG requires XSLT 2.0, which, as far as I understand, is only supported by Saxon. Regards, Alexey.