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

SVG text issues (pydyf version) #1345

Closed
pbregener opened this issue Apr 28, 2021 · 2 comments
Closed

SVG text issues (pydyf version) #1345

pbregener opened this issue Apr 28, 2021 · 2 comments
Labels
bug Existing features not working as expected
Milestone

Comments

@pbregener
Copy link
Contributor

pbregener commented Apr 28, 2021

Congrats on some nice work on the cairo-less WeasyPrint! Very impressive!

I use WeasyPrint a lot to generate PDF reports that contain tons of plots generated using matplotlib. The plots get written as SVG files and end up as nice-looking vector graphics in the PDF. The fact that the new pydyf-based WeasyPrint opens the door to inline-SVGs is pretty exciting, as it makes it even easier to include SVGs that are generated on the fly in Python. So I'm really looking forward to WeasyPrint's bright future! 👍

Testing the beta (and master) I came across some issues, though. The biggest and most obvious problem can be seen below. It is based on a matplotlib example, but can be reproduced with pretty much any matplotlib-generated SVG.

WeasyPrint v52.5 ✅ WeasyPrint master (as of 27 Apr, 71c49b5) 🔴
wp-tmp-cairo-1 wp-tmp-1

To reproduce, run WeasyPrint on this HTML (I placed a matplotlib-generated SVG on GitHub):

<html>
<body>
<h1>Heading 1</h1>
<img src="https://raw.githubusercontent.com/pbregener/weasyprint-data/main/matplotlib-annotation-demo.svg" style="width: 100%;">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque aliquam
congue quam, in tincidunt tellus posuere in. Integer finibus ultricies enim eu
consequat. In dui sapien, ornare tincidunt sollicitudin sed, sagittis vitae
tortor. Integer vitae iaculis eros, pulvinar accumsan purus. In sit amet purus
semper, elementum felis mollis, porttitor est. Cras eu ex tellus. Proin rutrum,
sem ac elementum auctor, enim sem volutpat sem, quis tincidunt ante nisi in leo.
Mauris bibendum dui nec convallis porttitor. Nullam non quam a elit sagittis
ultrices a vel metus. Donec ullamcorper malesuada odio, non tempor ipsum ornare
vitae. Mauris consectetur dolor at ligula fermentum, sit amet feugiat orci
lobortis. Fusce quis malesuada purus. Interdum et malesuada fames ac ante ipsum
primis in faucibus. Donec ullamcorper a mi eu ornare.
</p>
<p>
Nunc posuere, turpis nec varius dictum, risus urna condimentum felis, non
pulvinar est ex ut nulla. Aenean viverra, lectus eget dapibus posuere, justo
risus lacinia dui, et euismod arcu turpis ut augue. Cras nisi diam, ultricies
vel hendrerit tempor, fermentum a lectus. Aliquam erat volutpat. Proin ornare
lacus sit amet malesuada feugiat. Etiam nec felis ac lectus dapibus aliquam. In
feugiat lobortis suscipit. Donec at facilisis est, eu finibus sem. Suspendisse
massa augue, pulvinar vitae iaculis a, feugiat vel libero. Quisque quis nunc
ligula. In hac habitasse platea dictumst. Donec sit amet tortor in tortor
malesuada venenatis eget sit amet ex. Phasellus vestibulum eros ut nibh molestie
viverra. Morbi id volutpat risus, et condimentum tellus. Pellentesque tempus
efficitur velit a consectetur.
</p>
</body>
</html>
@liZe liZe closed this as completed in 26cc19c Apr 28, 2021
@liZe
Copy link
Member

liZe commented Apr 28, 2021

Hello, thanks a lot for the report!

use tags with x or y attributes were translated twice, that’s always a pleasure when removing lines fixes bugs 😄.

@liZe liZe added the bug Existing features not working as expected label Apr 28, 2021
@liZe liZe added this to the 53.0b2 milestone Apr 28, 2021
@pbregener
Copy link
Contributor Author

Thanks for a lightning fast fix! ⚡
Can confirm that this bug is fixed on master now.

I came across a few additional SVG-related issues, will try to reproduce them cleanly and then file new issues accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants