Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firefox svg TSP在不同浏览器中以不同方式在文本路径中平移_Firefox_Svg_Microsoft Edge - Fatal编程技术网

Firefox svg TSP在不同浏览器中以不同方式在文本路径中平移

Firefox svg TSP在不同浏览器中以不同方式在文本路径中平移,firefox,svg,microsoft-edge,Firefox,Svg,Microsoft Edge,我正在使用textPath和tspans将文本放入svg路径中,它在Chrome中工作得很好,但在Edge和FF(o)中没有这么多。任何帮助都将不胜感激 以下是svg节点的JSFIDLE: 以下是相关的文本代码: <text text-anchor="middle" font-size="8pt" font-family="Calibri" pointer-events="none"> <textPath xmlns:xlink="http://www.w3.org/

我正在使用textPath和tspans将文本放入svg路径中,它在Chrome中工作得很好,但在Edge和FF(o)中没有这么多。任何帮助都将不胜感激

以下是svg节点的JSFIDLE:

以下是相关的文本代码:

<text text-anchor="middle" font-size="8pt" font-family="Calibri" pointer-events="none">
    <textPath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text_5_4_5_1590" startOffset="50%">
        <tspan dy="-14pt">12): Maintain a</tspan>
    </textPath>

    <textPath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text_5_4_5_1590" startOffset="50%">
      <tspan dy="8pt">policy that</tspan> 
    </textPath>

    <textPath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text_5_4_5_1590" startOffset="50%">
       <tspan dy="8pt">addresses</tspan>
    </textPath>

   <textPath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text_5_4_5_1590" startOffset="50%">
    <tspan dy="8pt">information security</tspan>
    </textPath>

   <textPath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text_5_4_5_1590" startOffset="50%">
      <tspan dy="8pt">for all personnel. </tspan>
  </textPath>
    </text>

12) :维持
政策规定
地址
信息安全
适用于所有人员。

根据我的经验,SVG文本元素通常都有很多问题。我建议最大限度地提高跨浏览器的安全性,为每个文本片段使用单独的文本元素,并使用正常的x/y定位和变换/旋转来渲染文本

Firefox实际上正在正确渲染。根据1.1规范,每个新文本路径的开始应该是当前文本位置的绝对重置。您应该手动调整TSPAN的dy偏移量,使它们是累积的(而不是任何一个中的8pt,它应该是8pt、16pt、24pt)。所以你的东西一开始就可以工作,这实际上是一个Chrome bug


Edge似乎只支持每个文本元素一个textPath元素,因此您确实需要将每个textPath包装在其自己的文本元素中。

好吧,我对此并不感到非常兴奋。不管怎样,非常感谢您的回复!