Closed michielkauwatjoe closed 5 years ago
Hi!
The problem is that the default color space in PDF is DeviceGray
[1] and SVG does not yet support anything like it. As SVG does not have a notion of a graphic state, I think it is preferred to do what PDF does, namely to default to grayscale. The proper fix would be to use device-gray
in all svg
methods of color.py
but the spec is not yet final.
That said, a much easier fix in case of SVG is to explicitly ask for RGB color space for every shape()
and not relying on the defaults. Would that work for you?
[1] see e.g. PDF Referece 1.3, 4.3 Graphics State [2] https://www.w3.org/TR/2013/WD-SVG2-20130618/color.html#Unmanaged
I see now that our code should already initialize RGB color after a new shape is created, but I guess something is resetting it somehow. I'll look into it, thanks again!
Fixed it, that helped :) I'll close this issue.
Hi again, when I try to export a shape to SVG, I get this traceback:
which seems to be caused by the default stroke value in style, set to
gray(0)
. Not sure if there's a proper way to implement grayscale for SVG, however setting the default stroke to a RGB value, for examplergb(100, 100, 100)
, seems to circumvent the problem. Should I create another pull request?M.