在 Inkscape 中导入以下 SVG 文件仅显示文本但忽略<use>语句(或其引用的组)。这是一个错误还是一个功能?有什么要改变的吗?顺便说一句,该<g>组比示例文件中的组更复杂。该文件在 Chrome 中正确显示。(Windows 10,Inkscape 最新版本)
谢谢!马里奥
<svg width="400" height="200" x="0" y="0"
xmlns="http://www.w3.org/2000/svg">
<defs>
<g id="plus">
<circle cx="40" cy="30" r="20" stroke="#FF0000" fill="none"></circle>
</g>
</defs>
<svg x="100" y="50">
<rect x="1" y="1" width="78" height="86" rx="10" ry="10" stroke="#0000FF" fill="none"></rect>
<use href="#plus"></use>
<text x="20" y="74" width="68" height="26">ABCD</text>
</svg>
</svg>
Run Code Online (Sandbox Code Playgroud)
<use href="#plus">应该是<use xlink:href="#plus">。此外,您还需要向xmlns:xlink根 SVG 标签添加一个属性。
<svg width="400" height="200" x="0" y="0"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<g id="plus">
<circle cx="40" cy="30" r="20" stroke="#FF0000" fill="none"></circle>
</g>
</defs>
<svg x="100" y="50">
<rect x="1" y="1" width="78" height="86" rx="10" ry="10" stroke="#0000FF" fill="none"></rect>
<use xlink:href="#plus"></use>
<text x="20" y="74" width="68" height="26">ABCD</text>
</svg>
</svg>
Run Code Online (Sandbox Code Playgroud)
如果您进行了这些修复,文件就会加载到 Inkscape 中。