1、QT使用SVG 1.2规范解析svg
SVG Tiny,不是完整的SVG规范,虽然SVG Tiny确实支持“tspan”,但它也声明了这一点:
“SVG Tiny 1.2中的'tspan'上没有诸如'x'、' y'和'rotate'等位置属性。
2、解决方法
将svg中tspan节点的位置属性和值挪到text中即可,如
<svg xmlns="http://www.w3.org/2000/svg"
width="100%" height="100%" viewBox="0 0 400 400"
direction="rtl" xml:lang="fa">
<title direction="ltr" xml:lang="en">Right-to-left Text</title>
<desc direction="ltr" xml:lang="en">
A simple example for using the 'direction' property in documents
that predominantly use right-to-left languages.
</desc>
<text x="200" y="200" font-size="20">داستان SVG Tiny 1.2 طولا ني است.</text>
</svg>
3、参考
https://stackoverflow.com/questions/37548128/multi-line-centered-text-in-svg-rendered-in-qthttps://www.w3.org/TR/SVGTiny12/text.html#TSpanElement