There appears to be a regression between Batik 1.6 and 1.7 Beta 1 with regard to Apache FOP 0.93. As I am neither an expert at Batik nor FOP, I will struggle to define the issue, but here goes: Apache FOP delegates to Batik whenever it encounters some embedded SVG. If the embedded SVG contains 'font-family='sans-serif', FOP will pass that to Batik, and Batik will (for good reasons I'm sure) convert that to 'SansSerif'. It then seems (I could be wrong) that if the SVG contains embedded text, Batik will pass that BACK to FOP to render. When it does this, however, it passes back 'SansSerif' instead of 'sans-serif', which FOP cannot resolve and substitutes 'any,normal,400' instead. Generally, 'any' does not equal 'sans-serif'. You can work around this behaviour by doing... Fop fop = FOP_FACTORY.newFop( getMimeType(), p_out ); FOTreeBuilder contentHandler = (FOTreeBuilder) fop.getDefaultHandler(); FontInfo info = contentHandler.getEventHandler().getFontInfo(); info.addFontProperties( "F1", FontInfo.createFontKey( "SansSerif", "normal", 400 ) ); ...(eg. tell FOP what 'SansSerif' means) - but that doesn't seem ideal. Batik 1.6 didn't seem to have this problem? I am using JFreeChart 1.0.5 to generate the SVG (via Batik 1.7), and FOP 0.93 to render the PDF (also via Batik 1.7) Regards, Richard.
Sorry - I forgot to say thanks for all your hard work on Batik! It really is an awesome product, and I have found it extremely useful for many years. I am particularly excited about a 1.7 release, because then I can stop using a trunk-version of 1.6. Richard.
Batik probably needs to have its font mappings configurable. Currently it's done statically in org.apache.batik.gvt.font.FontFamilyResolver. FOP guys, is that what you would need to ensure that generic font names like sans-serif get rendered in the font of FOP's choice on the PDFGraphics2D?
A recent change in FOP (SVN) may have fixed this: http://svn.apache.org/viewvc?rev=591579&view=rev Could you test again with an SVN version of FOP and Batik?
Wonderful! I can confirm this problem is now fixed in the latest (0.95 BETA) release of FOP. Thanks again for everybody's hard work and dedication to the cause :)