Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where scaling wasn't properly applied to stroke widths #30

Merged
merged 1 commit into from
May 19, 2023
Merged

Fix bug where scaling wasn't properly applied to stroke widths #30

merged 1 commit into from
May 19, 2023

Conversation

LaurenzV
Copy link
Collaborator

Consider the following svg:

<svg width="100" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg">
    <rect width="100" height="100" fill="white"></rect>
    <g transform="scale(.1 .1)">
        <line x1="0" x2="1000" y1="150" y2="150" stroke="#000" stroke-width="5"/>
    </g>
</svg>

It is currently rendered like this:
image

Even though it should look more like this:
image

The reason for this is that there was no scaling applied to the width of strokes. This PR should fix this. I looked into how it's done in resvg and tried to replicate this behavior in svg2pdf.

@laurmaedje laurmaedje merged commit 35f4bb8 into typst:main May 19, 2023
@laurmaedje
Copy link
Member

Thanks!

@LaurenzV LaurenzV deleted the stroke-width-fix branch May 20, 2023 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants