Hello everyone,

Many modern design tools like Figma and others do not put offset attribute
when generating an SVG image if offset equals 0. See
https://www.w3.org/TR/SVG/pservers.html#GradientStopAttributes
Example:

<linearGradient id="paint1_linear" x1="27.5676" y1="16.8208"
x2="22.4964" y2="1.6674" gradientUnits="userSpaceOnUse">
  <stop stop-color="#FE2857"/>
  <stop offset="0.0784" stop-color="#CB3979"/>
  <stop offset="0.1601" stop-color="#9E4997"/>
  <stop offset="0.2474" stop-color="#7557B2"/>
  <stop offset="0.3392" stop-color="#5362C8"/>
  <stop offset="0.4365" stop-color="#386CDA"/>
  <stop offset="0.5414" stop-color="#2373E8"/>
  <stop offset="0.6576" stop-color="#1478F2"/>
  <stop offset="0.794" stop-color="#0B7BF8"/>
  <stop offset="1" stop-color="#087CFA"/>
</linearGradient>

Batik fails with exception while trying to read such svg files. Other
programs successfully open them.

Some time ago, I've submitted a PR at
https://github.com/apache/xmlgraphics-batik/pull/20 The pull request sets
offset to 0 when the attribute is missing.

The patch is available here
https://github.com/apache/xmlgraphics-batik/pull/20/commits/20ad4382a0a4613956d1e543002e81b235ad1561

or as a patch file
https://github.com/apache/xmlgraphics-batik/pull/20/commits/20ad4382a0a4613956d1e543002e81b235ad1561.patch


IntelliJ Platform (with 13M+ users) uses Batik library and we have a big
number of tickets that some icons are not rendered.

*Could you please review and integrate the patch?*

Attachments:

*github-pr-20.patch* - patch file

*test.svg* - an icon demonstrating the problem

With best regards,

Konstantin

Attachment: github-pr-20.patch
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-h...@xmlgraphics.apache.org

Reply via email to