2011-07-17 85 views
1

我想了解svg中的tspan标记,这里有些奇怪。看看下面的代码,FF和Chrome在tspans之间引入了一个水平偏移量,但不应该有。SVG tspan水平偏移

<svg width="625" height="470" xmlns="http://www.w3.org/2000/svg"> 
<text y="406" x="379" text-anchor="start" stroke-width="0" stroke="#000000" fill="#FF0000"> 
<tspan x="379" font-weight="normal" font-style="normal" font-size="24" font-family="Arial" fill="#000000" dy="0">a</tspan> 
<tspan font-weight="normal" font-style="normal" font-size="24" font-family="Arial" fill="#000000">aa</tspan> 
</text> 
</svg> 

现在去http://svg-edit.googlecode.com/svn/trunk/editor/svg-editor.html,并输入在SVG编辑器的代码(在顶部菜单栏中的第二个按钮),然后应用更改。 tspans之间的偏移量不存在!我找不到为什么,在HTML,SVG和CSS中似乎没有什么特别的。

我希望有人能解决这个谜题。它似乎被连接到字体大小,改变偏移量。但是,当它设置为0px时,文本消失。

回答

3

tspans之间的换行符将被转换为空格。我猜想svg-edit会将它们剥离。

+0

你真棒 – pogon

+0

谢谢 - 这一直让我疯狂 - Chrome处理换行符和空格与HTML相同 - 我想知道关于规范是否正确。 – scytale