How to place a symbol (path) relative to the far end of svg text?

Posted by dugeen on Stack Overflow See other posts from Stack Overflow or by dugeen
Published on 2010-03-11T20:38:19Z Indexed on 2010/03/12 8:27 UTC
Read the original article Hit count: 124

Filed under:
|

I'm working on a program which generates SVG maps. Some of the map items have captions which need a symbol after them (like a plane symbol for an airport caption).

If I have a text element thus

<text x="30" y="30">Pericles</text>

I can place another bit of text at the next character position by saying

<text x="30" y="30">Pericles <tspan>!</tspan></text>

but I'd like to draw my own symbol at that position with a <path> element.

What I'm doing at the moment is having the generating program guess the extent of the text from tables of font metrics etc, but this isn't accurate enough to place the symbol consistently.

Is there any way round this - like specifying a <marker> to be used when drawing the text, and using a tspan with an invisible dash in it or something to get the marker placed?

© Stack Overflow or respective owner

Related posts about svg

Related posts about text