fxsvgimage
fxsvgimage copied to clipboard
Arrow marker not rendered correctly
I have an SVG made with inkscape containing arrow heads as markers, which fxsvgimage does not render: aufstellung-rearranged-plain
So I wanted to convert the arrow to a path via Path>Stroke to Path (as mentioned in https://stackoverflow.com/a/10480412/6723250), but the resulting SVG somehow crashes the SVGLoader.load
such that it does not even throw an exception but simply returns null
:
aufstellung-rearranged-slim
Converting the SVG via ImageMagick also produces something not understood by SVGLoader :/
Thanks, I will try the two svg files ASAP.
For the first problem, it's because the "marker" element is not supported ATM. It should not be difficult to support it, because the "use" element is already supported.
For the second, I have to debug :)
Trying with Batik via https://github.com/codecentric/javafxsvg I get this error on all of them, maybe that helps:
org.w3c.dom.DOMException: <unknown>:
The attribute "style" represents an invalid CSS declaration ("fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt").
Original message:
The "context-stroke" identifier is not a valid value for the "fill" property.
If you find a fix in the next two days that would be fantastic, and be it dirty ;)
Thanks, I will have a look this evening :)
The second problem (null result) is fixed in master (I created another issue just for this problem), but the marker element is still not rendered for the moment. Should be working tomorrow evening I hope
Almost fixed :)
I have an initial support for the marker element. Some things are still not handled correctly:
- The orientation of the marker is not taken into account, though it does not change anything in your use case I think
- The Positioning of the marker for a path is not correctly handled, but again in your case it does not impact the result
- The size of the marker does not take into account the viewport and markerWidth / markerHeigh of the marker
I will continue to add these features, because I think I know how to handle them (it's not bugs, but features which are not handled yet).
Normally the size of the marker now takes the viewbox into account (and the marker width and height)
You are awesome, I will stay with the converted PNG for now but check it out when I have more time ;)
Latest jitpack build fails :/ https://jitpack.io/com/github/hervegirod/fxsvgimage/c67eeb8e36/build.log
I'll take a look. Probably some structure changes that are not reflected in the pom.xml
I'll take a look. Probably some structure changes that are not reflected in the pom.xml
I will look also. And yes I changed things in the structure of the xml package a bit
OK, it's the org.girod.javafx.svgimage.xml.SVGShapeBuilder
java file which should not be there. It must be a mistake in my commit. For whatever reason, the deletion of this file was not pushed (the file does not exist in my local repo). The correct file is under the org.girod.javafx.svgimage.xml.builders
package (and it's there in the repo). I can fix this this evening, or you can do it yourself today and ask for a pull request, and I will accept the request. Whatever you prefer :)
Besides removing the org.girod.javafx.svgimage.xml.SVGShapeBuilder, the following addition is needed in the pom.xml on line 36 (between the testSourceDirectory and the plugins elements):
<testResources>
<testResource>
<directory>${project.basedir}/src/test</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
This will ensure that the svg files used by tests are copied properly.
However, i get test failure in SVGImageScaled2Test:
java.lang.AssertionError: width
Expected :25.0
Actual :1.0
...so maybe there are some other code changes missing in master?
I will look at that test regression as soon as I am home. Thanks!!
I seem to have broken something with the last modifications (those I did to fix this issue I think). I am sorry for that. I tested and as you said many test cases are broken. I will fix this mess ASAP.
I fixed these failing unit tests. These are problems I introduced after fixing issue #25