Bug 42123 - Regression: Batik 1.7 -> FOP converts 'sans-serif' to 'SansSerif'
Summary: Regression: Batik 1.7 -> FOP converts 'sans-serif' to 'SansSerif'
Status: RESOLVED FIXED
Alias: None
Product: Batik - Now in Jira
Classification: Unclassified
Component: SVG Rasterizer (show other bugs)
Version: 1.7
Hardware: Other other
: P2 regression
Target Milestone: ---
Assignee: Batik Developer's Mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-13 22:10 UTC by Richard Kennard
Modified: 2008-04-16 19:31 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Kennard 2007-04-13 22:10:58 UTC
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.
Comment 1 Richard Kennard 2007-04-13 22:20:31 UTC
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.
Comment 2 Cameron McCormack 2007-09-25 21:20:26 UTC
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?
Comment 3 Cameron McCormack 2007-11-06 17:12:30 UTC
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?
Comment 4 Richard Kennard 2008-04-16 19:31:18 UTC
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 :)