Support SVG transform angle units - #2737
Merged
Merged
Conversation
moreaki
marked this pull request as ready for review
April 21, 2026 22:57
liZe
requested changes
Apr 22, 2026
liZe
left a comment
Member
There was a problem hiding this comment.
Thanks a lot for this pull request. 🙏
Here’s a small list of comments, that’s only minor changes.
Contributor
Author
|
Thanks again for the careful review! I’ve addressed the angle-unit feedback in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Fixes #2735.
This adds SVG angle parsing for transform functions that take angles, so values such as
rotate(90deg),rotate(.25turn),rotate(1.5708rad), andskew(20deg)are treated as angles instead of lengths.Why
Generated SVGs commonly use explicit angle units in CSS transforms. Mermaid Gantt diagrams, for example, emit rules such as
transform: rotate(45deg) scale(...)for milestones androtate(90deg)for rotated tick labels. WeasyPrint previously parsed transform arguments as lengths before dispatching by transform function, which made angle units fail.Tests
python -m pytest tests/draw/svg/test_transform.py -qpython -m pytest tests/draw/svg -q