jfree / jfreesvg

A fast, lightweight Java library for creating Scalable Vector Graphics (SVG) output.
http://www.jfree.org/jfreesvg
GNU General Public License v3.0
319 stars 58 forks source link

Avoid writing double semicolon in SVG style attribute #52

Closed ghost closed 2 years ago

ghost commented 2 years ago

When exporting a plot from Renjin as SVG, a double semicolon is written. For example:

svg("/tmp/filename.svg");
plot(rnorm(5));
dev.off();

Renjin uses JFreeSVG, which produces:

<ellipse
  cx="61.5" cy="219.5" rx="2.5" ry="2.5"
  style="...snip... stroke-linecap: square;; fill: none" ...snip... />

Unfortunately, the ConTeXt typesetting engine has a bug that ignores styles after a null entry is detected in the style list, resulting in all such diagrams being rendered as a big black square (because the fill:none isn't honoured).

Any idea what's causing the ;; to be generated?

ConTeXt (PDF) on the left and FlyingSaucer (XHTML) on the right:

render-r-plot

FlyingSaucer handles ;; fine, but not ConTeXt.

jfree commented 2 years ago

The double semi-colon is a bug that is fixed in the main branch (JFreeSVG 5.0.2) but that didn't get back-ported to the 3.4.x series yet. I did that just now and pushed the changes, but I still have some more testing to do before I will release that.

ghost commented 2 years ago

This was also fixed in ConTeXt, which had issues with spaces within the style attributes. Much appreciated.