Skip to content

Conversation

@carlosame
Copy link
Member

Some people have complained that the SVG output by Batik's SVGGraphics2D is ugly or too big, see BATIK-502 or BATIK-1337. The serializer that svggen used was package-visible because it wasn't generically valid, and there was no way to customize the serialization.

This PR offers:

  • A public serializer which has general validity.
  • A new XmlSerializer interface that can be used to customize the serialization. Its default methods mimic what the previous code did.
  • A CompactXmlSerializer implementation which significantly decreases the size of the output files.
  • Methods for setting and getting a custom serializer to SVGGeneratorContext. The default is backwards-compatible as mentioned above.

To use the compact serializer just set it:

SVGGeneratorContext context = ...
context.setXmlSerializer(new CompactXmlSerializer());

@carlosame carlosame added this to the 2.3 milestone Nov 20, 2025
@carlosame carlosame added the enhancement New feature or request label Nov 20, 2025
@carlosame carlosame merged commit c1b961b into master Nov 22, 2025
6 checks passed
@carlosame carlosame deleted the fe-BATIK-502 branch November 22, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants