svgfontsbatik

Text distorting during PNG rendering in Apache Batik


There are some very strange distortion in the images that are rendered via Apache Batik.This issue is not temporary as the distortion is happening every time the call is made, at the very same co-ordinates for the same svg. This happens in Linux environments and I am not able to reproduce this issue in mac OS environments.I am using Oswald custom font (from google fonts) and there is usage of transformation attributes like letter-spacing, rotate functionality.

Tried many of the suggestions like: 1) Verified if the Oswald font is registered to the Graphics environment.

2) Removed text transformation attributes like letter-spacing,rotate, but still the distortion is occuring. We have also replaced letter-spacing attributes with kerning.Tried with shape-rendering="geometricPrecision" also to no success.

3) Tried with other fonts and din't face the distortion with Arial custom font, but with Oswald, Roboto the distortion still exists.Our usecase needs Oswald Font, hence we cannot use Arial font.

4) Tried SVG fonts by embedding the svg fonts in the svg file - No success.

5) Tried trim functionality but no success.

6) Replaced the characters where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.

7) Increased And decreased the font size by 1px where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.

I found few threads where the reason was mentioned that Batik rendering varies per OS environment but was not able to find any solution. Was anyone able to solve this?


Solution

  • Upgrading JDK from 8 to 11 has solved the problem.