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 tspan not respecting text-anchor #2043

Merged

Conversation

michaellisitsa
Copy link

@michaellisitsa michaellisitsa commented Jan 18, 2024

text-anchor attribute on tspan is not respected. It previously worked in v60.1 however the logic for text-anchor was moved into the svg/__init__.py file and caused this edge case not be handled, and there were no specific test cases.

See example below where text-anchor="middle" doesn't do anything

Tests pass

Replit reproducing bug: https://replit.com/@mlisitsa/Python-Weasyprint
Example:

<svg
  width="600"
  height="217"
  role="img"
  viewBox="0 0 600 217"
  style="pointer-events: all; width: 100%; height: 100%"
>
  <text x="10" y="30" class="small">
    <tspan x="0" dx="0" dy="0" text-anchor="middle" >Middle</tspan>
    <tspan x="0" dx="0" dy="15">Start</tspan>
  </text>
</svg>

@michaellisitsa michaellisitsa marked this pull request as ready for review January 18, 2024 04:34
@grewn0uille grewn0uille added this to the 61.0 milestone Jan 26, 2024
@grewn0uille
Copy link
Member

Thanks!

@grewn0uille grewn0uille merged commit 4edb03d into Kozea:main Jan 26, 2024
6 checks passed
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.

3 participants