question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gabelernercommented, Jan 11, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found