在 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>
最佳答案
<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>
如果您进行了这些修复,文件将加载到 Inkscape 中。
关于svg - Inkscape 忽略 <use>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56061765/