Closed markustw closed 4 years ago
Thanks for the report. I had a quick look, the LineBorder class in Swing is drawing the border by filling a path with an inner and an outer boundary:
Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
path.append(outer, false);
path.append(inner, false);
g2d.fill(path);
g2d.setColor(oldColor);
I'll have to dig deeper into how the path is translated for rendering in SVG, there must be some error there.
The path element was using the default winding rule, whereas in this case the "even-odd" rule is required. I've committed a fix for this (to be included in the next release, 4.2).
Thank you. Please note that OrsonPdf has the same issue. Shall I open an Issue for OrsonPdf ?
Creating SVG of a JLabel with a colored border with SVGGraphics2D paints a filled rectangle in the size of the label instead of a text surrounded by a rectangle:
JLabel label = new JLabel("Label with border"); label.setBorder(BorderFactory.createLineBorder(Color.YELLOW)); // removing border shows text label.setSize(label.getPreferredSize());
SVGGraphics2D graphics = new SVGGraphics2D(100, 40); label.printAll(graphics);
Sorry for filing in another issue. We just tested JFreeSVG for generating SVG in our application. This and issue #24 are the two major issues we found.