Skip to content

clipPath SVG element with transform rendered incorrectly #1634

Closed

Description

@Julian-Wassmann

Description

Issue happens with SVG images with a <clipPath> element. If the children have a transform attribute, the rendering order seems to be wrong. This can result in SVG files having a black backgground.

See the following example from an SVG:

<clipPath id="myClip">
  <circle transform="scale(.9)" cx="40" cy="35" r="35" />
</clipPath>

If the transform attribute is skipped (or scale=1), then the bug doesn't occur.

If using the Web App, the output shows correctly in the document preview. But the downloaded PDF contains the bug. The bug also happens with the Windows compiler.

I noticed that the issue exists in Version 0.4.0 - 0.6.0 (current). In Version 0.3.0, the issue does not occur. I hope this helps for finding the issue.

Please have a look at the shared document. Make sure to download the PDF (the issue doesn't happen in the preview).

Thanks a lot!

Reproduction URL

https://typst.app/project/ro-8glg-79CJ_ekz6LCizG

Operating system

Windows

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Jun 30, 2023
  2. LaurenzV commented on Jun 30, 2023

    @LaurenzV
    Collaborator

    Yeah, the current svg conversion library doesn't deal with clip paths very well. The good news is that I'm currently trying to rewrite the library and your svgs look correctly in that case, but it might be a while until the rewrite is completely finished.

    Could you add the svg label to this issue as well?

  3. added
    svg
    on Jul 3, 2023
  4. LaurenzV commented on Jul 21, 2023

    @LaurenzV
    Collaborator

    Will be fixed once this PR gets merged and upstreamed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsvg

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions