Open ctrlcctrlv opened 3 years ago
I have found the issue. It is in the nanosvg.h
library, in the function nsvg__parseColorRGB
.
It cannot understand decimal values in the percentage. If I use fill:rgb(30%,30%,30%)
, it's all fine.
@erco77 has a patch here: https://github.com/memononen/nanosvg/issues/136#issuecomment-761201063
I think it will work to solve this.
Given that the upstream nanosvg maintainer is paying attention, I suggest the best thing to do is agree on a solution and put together a good PR upstream first. Once it is fixed there we can update our vendored version. If it was unmaintained or there was another roadblock I might consider patching locally, but in this case I don't see any reason this can't get fixed as far upstream as it possible.
(Also keep a weather eye out on Rust crates that might make viable alternatives for SVG handling in the future.)
@alerque memononen/nanosvg#136 is now closed by memononen/nanosvg#198 and just needs a release. However, NanoSVG has needed a release since April (memononen/nanosvg#197). If one isn't made soon hopefully using the development version is not such a big deal for SILE.
No, I don't think using the HEAD version would be a problem for us. I'd rather they cut a release like they clearly need to, but we could deal with using anything on their default branch I suppose.
cf. #1205
I'm pushing this to the next release cycle because "just one more thing" is already significantly delaying the math release and I want to get that cleaned up and out the door.
I commonly use
cairosvg
on the command line to clean up SVG files I intend to put into SILE documents. One thing that it does that I need is it takes<use/>
elements and puts whatever is in the referent<symbol/>
there, while keeping track of transforms. (SILE cannot understand<use/>
at all.)Unfortunately,
cairosvg
also transforms color elements as part of its cleanup. It transformsfill:#4d4d4d
tofill:rgb(30.196078%,30.196078%,30.196078%)
. SILE interprets this as cyan, not the expected grey.Minimal example
These two SVG should be rendered equivalently:
box.svg
box2.svg
min.sil
Output