typst / svg2pdf

Converts SVG files to PDF.
Apache License 2.0
293 stars 38 forks source link

Masked SVG rendered inconsistently #78

Open LaurenzV opened 4 months ago

LaurenzV commented 4 months ago

Given the following SVG:

<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
    <title>Simple case</title>
    <mask id="mask1" mask-type="luminance">
        <rect id="rect1" x="0" y="0" width="200" height="200" fill="rgb(0 0 255)" opacity="1"/>
    </mask>
    <rect id="rect2" x="0" y="0" width="200" height="200" fill="rgb(255 0 0)" mask="url(#mask1)"/>
</svg>

Here is how they are rendered in different viewers: mask_luminance-0

pdfium, pdf.js and pdfbox get the same output as Acrobat, while mupdf and Quartz get a slightly different output. Xpdf fails completely. So most likely a viewer issue, but would still be nice to investigate.