CourtBouillon

Authentic people growing open source code with taste

WeasyPrint v70 Has Been Released

WeasyPrint v70 has been released! It comes with CSS Notes and COLR fonts support, and more 😊 The changelog also contains security information.

⚠️ We strongly recommend to upgrade WeasyPrint to the latest version if you embed untrusted images, or rely on the URL fetcher to filter metadata or stylesheets passed as Python parameters. ⚠️

CSS Notes

Thanks to the amazing NLnet Foundation, we had a grant to work on new CSS specifications with Julie Blanc and Julien Taquet from Paged.js. The grant is allocated for several specifications, and one of them is CSS Notes.

To keep it short, in CSS, the only type of notes that is specified is footnotes (and WeasyPrint already supports them 😁). That means there is nothing to have other types of notes, like sidenotes for example. The goal of this specification is to define that.

Now you can create things like this with WeasyPrint:

Lorem ipsum text with notes floating top left
Notes floating left

If you want more details about CSS Notes and how to use them with WeasyPrint, you can read our dedicated article. If you want more more details, you can read our specification proposal.

Please note that CSS Notes isn’t ready for production. It’s the first draft of the specification, the first implementation of this same specification and it’ll surely evolve 🚶‍➡️.

But we’d really like to have real use cases so don’t hesitate to give a try to this feature and send us feedback!

COLR Fonts

A COLR table had been added to OpenType fonts to embed emojis, as an alternative to SVG (vector but complex) and CBDT (simple but raster) tables. Now, many fonts use it but it wasn’t yet supported in WeasyPrint, thus causing bad renderings with emojis 😵‍💫.

But that’s ancient story!

We added COLR fonts support in this version. Your emojis should now render as nice and sweet as they used to before COLR fonts 🥳!

If you use the WeasyPrint version that is packaged with your distribution, you have nothing special to verify. Else, you need HarfBuzz 13+ and HarfBuzz-Vector.

If your distribution doesn’t provide these packages, don’t worry, you still can use classic SVG or CBDT emoji fonts.

And More…

As usual, this new version of WeasyPrint comes with various improvements and 🐞 bug fixes, including:

  • support of box-shadow property,
  • PDF/UA improvements for forms and nested lists,
  • support of RTL SVG text anchoring,
  • handling of spaces and newlines in URLs,
  • better filename detection for attachments,
  • raster emojis position,
  • calc() inside line-height.

Feel free to have a look at the changelog if you want to see the full list!

What’s Next?

We hope you’ll have fun with this new version!

18 people participated to this release. Thanks a lot to everyone for their contribution 🫶.

This release has been quite hard for us because of the increasing noise in issues and pull requests. It took us a lot of time to manage. For example, in July, we closed 45 pull requests.

Now, we have a limitation of 1 opened pull request per account on our projects and added contribution guidelines. We hope it’ll help us to not drown under sloppy contributions and to still having fun in developing WeasyPrint.

If you use WeasyPrint professionally, we offer several services to assist you:

  • the consulting packages: if you want to have a quick answer guarantee,
  • templating: to give life to your documents,
  • workflow integration: to include WeasyPrint at its best into your application,
  • bug fix and new feature support: if you need something quite fast.

Don’t hesitate to drop us one short mail and share your needs so we can help you!