-
-
Notifications
You must be signed in to change notification settings - Fork 711
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 elements do not support textLength and lengthAdjust attributes #1921
Comments
That would be a nice feature to have! |
Oh definitely 😄 |
That’s right.
It’s doable, but probably a bit complicated. A "simple" proof of concept would be to use the Don’t be afraid to try, we’re available to help if needed! (Of course, that’s just a first step. We then would have to handle other "details" such as nested |
Oh that sounds quite straightforward, so basically calculate the difference between |
Implemented the PoC, here's the result for the SVG in the description: while it works quite nicely, the spacing strategy has the unintended consequence of introducing whitespace within the words, making them unsearchable. Not sure how that could be avoided 😓 |
That’s great, thanks a lot! 😍💜 I’ll clean a few things and get back to you soon. If you have some motivation left, you can add some tests in |
I'll look into the tests today, and push them to the PR when ready 😃 |
Fixed by #1922. |
According to the specs,
textLength
should be a valid attribute for SVG text elements. However, it seems Weasyprint is ignoring it. The same applies forlengthAdjust
.Here's an example SVG:
Expected:

Result:

The text was updated successfully, but these errors were encountered: