SVG text-anchor does not work with <tspan>
See original GitHub issue<tspan text-anchor="start|middle|end"
does not work with canvg.
Sample code:
<svg width="200" height="200">
<text x="100" y="50">|
<tspan x="100" y="50" text-anchor="start">Xtra</tspan>
</text>
<text x="100" y="100">|
<tspan x="100" y="100" text-anchor="middle">Xtra</tspan>
</text>
<text x="100" y="150">|
<tspan x="100" y="150" text-anchor="end">Xtra</tspan>
</text>
</svg>
Using this code with canvg will ignore the text-anchor
property and use the default value of start
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Issue with SVG tspans not aligning with text-anchor="end"
This is caused by the whitespace in your XML between the <tspan> elements. If we remove that, your problem disappears. svg ...
Read more >text-anchor - SVG: Scalable Vector Graphics - MDN Web Docs
The text-anchor attribute is used to align (start-, middle- or end-alignment) a string of pre-formatted text or auto-wrapped text where the ...
Read more >⚓ T200443 SVG text-anchor=end confused by tspan with ...
The text element starts a new text chunk, but that text chunk never gets any characters and remains empty. The tspan element has...
Read more >SVG text-anchor=end confused by tspan with following #text
A text element with text-anchor="end" whose children are a tspan element followed by a #text node renders incorrectly.
Read more >text-anchor incorrectly inherited in tspan - Inkscape - GitLab
aligning should be as in resvg ink. ... SVG Text Chunk · SVG Text Chunk_r · SVG Text Chunk_re ... 31d15140 - Update...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
you can now try the 2.0 beta @ https://www.npmjs.com/package/canvg/v/2.0.0-beta.0 or https://cdn.jsdelivr.net/npm/canvg@2.0.0-beta.0/dist/browser/canvg.min.js /cc @Puine
hey @Puine i fixed it in master but haven’t published a new version to npm yet. i’ll probably push up a
2.0
release this weekend so look for that