1
问:SVG tspan渲染差异 - 在IE或Chrome或两者中的错误?
下面SVG
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect id="rect2993" x="20" y="40" width="1000" height="300" style="fill:#aa0000" />
<!--
<text x="20" y="40">Example SVG text 1</text>
-->
<text id="txtErrorTitle" x="20" y="40" style="font-size:40px;font-style:normal;font-weight:normal;letter-spacing:0px;word-spacing:0px;fill:#aa0000;fill-opacity:1;stroke:none;font-family:Sans;"
xml:space="preserve" >
<tspan id="tspan2994" x="10" y="67" style="fill:#FF00FF">
System.Web.HttpException
</tspan>
<tspan id="tspan29914" x="10" y="100" style="fill:#FF00FF">
System.Web.HttpException
</tspan>
</text>
<circle cx="20" cy="40" r="10" stroke="black" stroke-width="1" fill="yellow" fill-opacity="0.75" />
<circle cx="1020" cy="340" r="10" stroke="black" stroke-width="1" fill="yellow" fill-opacity="0.75" />
<circle cx="10" cy="67" r="10" stroke="black" stroke-width="1" fill="orange" fill-opacity="0.75" />
<text x="1020" y="340" fill="red" transform="rotate(45 1020,340)">I am rotated SVG text</text>
<foreignObject class="node" x="46" y="422" width="200" height="300">
<body xmlns="http://www.w3.org/1999/xhtml">
<div>
The quick brown fox jumps <font style="color: hotpink;">over</font> the lazy dog. <br />Pack my box with
five dozen liquor jugs
</div>
</body>
</foreignObject>
</svg>
在IE中呈现像我期望它:
然而,Chrome和Firefox,它呈现这样的:
虽然我发布这个问题,但我只是意识到外部对象不会在IE中呈现,这并不令人惊讶,因为IE一直是越野车和落后。但我的实际问题不是关于异物。
我实际的问题是:
为什么文本 “System.Web.HttpException” 的位置不是在Chrome/FireFox的位置(10,67)和(10,100)?
这是Chrome/FireFox渲染中的错误吗?
或者我错过了SVG方式的东西,它是IE又是越野车吗?
我觉得特别奇怪的是第二个tspan是appx。 10在前一个tspan元素的右侧。 它几乎好像TSPAN坐标是相对于前面的元素,但后来它的奇怪的是,还有的67.547935没有Y轴偏移量...
就是这样。谢谢 !删除它,现在工作。 xml:space =“preserve”来自inkscape。正如怀疑的那样,IE是一辆越野车。从InkScape保存时需要选择“Plain SVG”,否则使用InkScape SVG ... – 2014-09-05 14:06:40