1 year ago
#220704
Gurubg
Apache FOP XSLT with svg-text render quality chaged after batik library upgrade
We recently migrated from FOP 2.1 to FOP 2.6 and witnessed a change in PNG output quality.
In our application fop is used with antialiasing OFF and in fop2.1 ( +batik 1.8) the text output is rendered nicely with no antialiasing .
But after we upgraded to FOP 2.6, PNG output is generated with antialiasing, without considering the fop.xconf setting or the text-rendering settings.
I tried various options by setting different text-rendering values but not able to get the same quality any more. I tried different versions of Batik lib and it seems that this change is seen from v1.9 onwards. Seems like batik is ignoring anti-aliasing OFF configuration from the fop.xconf .
fop.xconf
<?xml version="1.0"?>
<fop version="1.0">
<complex-scripts disabled="false"/>
<renderers>
<renderer mime="image/png">
<color-mode>rgb</color-mode>
<transparent-page-background>false</transparent-page-background>
<background-color>white</background-color>
<anti-aliasing>false</anti-aliasing>
<rendering>false</rendering>
<fonts>
</fonts>
</renderer>
</renderers>
</fop>
Sample XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
<xsl:param name="versionParam" select="'1.0'"/>
<xsl:template match="articles[@page=1]">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="168px" page-width="384px">
<fo:region-body /> <!-- background-color="#FFFF00" -->
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<!-- Temporarily Unavailable -->
<fo:block-container position="absolute" overflow="visible">
<fo:block>
<fo:instream-foreign-object xmlns:svg="http://www.w3.org/2000/svg">
<svg xmlns="http://www.w3.org/2000/svg" height="100" width="240" viewport="10 10 290 200">
<text x="150" y="20" fill="black" text-anchor="start" font-size="22pt" text-rendering="optimizeLegibility">STWOA</text>
</svg>
</fo:instream-foreign-object>
</fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
Any help or hints would be highly appreciated !
xslt
xsl-fo
apache-fop
batik
0 Answers
Your Answer