WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

SVG gradients don't render

Open TadaCZE opened this issue 3 years ago • 2 comments

I noticed when trying to add the following file into my document, that the gradient on the letter j does not render and the letter is not displayed. I do not know if this is a bug or unimplemented feature, but the support for gradients already is in weasyprint for normal html. If anyone knows what I need to achieve without svg gradients, tell me (a workaround).

stavjani

TadaCZE avatar Sep 15 '22 08:09 TadaCZE

Hi!

The problem is that we don’t support (yet) the href attribute of gradients.

As a workaround, you can replace

      <linearGradient
          inkscape:collect="always"
          id="linearGradient885">
        <stop
            style="stop-color:#b388c5;stop-opacity:1;"
            offset="0"
            id="stop881" />
        <stop
            style="stop-color:#030422;stop-opacity:1;"
            offset="1"
            id="stop883" />
      </linearGradient>
      <linearGradient
          inkscape:collect="always"
          xlink:href="#linearGradient885"
          id="linearGradient887"
          x1="81.66954"
          y1="71.572083"
          x2="84.236176"
          y2="51.393879"
          gradientUnits="userSpaceOnUse" />

by

      <linearGradient
          inkscape:collect="always"
          id="linearGradient887"
          x1="81.66954"
          y1="71.572083"
          x2="84.236176"
          y2="51.393879"
          gradientUnits="userSpaceOnUse">
        <stop
            style="stop-color:#b388c5;stop-opacity:1;"
            offset="0"
            id="stop881" />
        <stop
            style="stop-color:#030422;stop-opacity:1;"
            offset="1"
            id="stop883" />
      </linearGradient>

I’ve seen (too?) many SVG documents in my life, I’ve spent weeks reading the documentation, and it’s the first time I meet this feature. This format is full of beautiful features that we should consider as presents given to the people spending their sleepless nights implementing renderers, what an incredible time to be alive…

liZe avatar Sep 15 '22 09:09 liZe

thanks!

TadaCZE avatar Sep 15 '22 09:09 TadaCZE