font-family:monospace
と
white-space:pre
に頑張って欲しいのですが、SafariはできるのにChromeがだめです。
<svg viewBox="0 0 400 400" style="width:400px">
<line x1="0" y1="0" x2="400" y2="0" stroke="black" />
<line x1="0" y1="0" x2="0" y2="400" stroke="black" />
<g transform="translate(0, 10)">
<text x="0" y="10">0123456789</text>
<text x="0" y="30">abcdefghijklmn</text>
</g>
<g transform="translate(0, 60)">
<text x="0" y="10" style="font-family:monospace;">0123456789</text>
<text x="0" y="30" style="font-family:monospace;">abcdefghijklmn</text>
</g>
<g transform="translate(0,110)">
<text x="0" y="10" font-family="monospace">0123456789</text>
<text x="0" y="30" font-family="monospace">abcdefghijklmn</text>
</g>
<g transform="translate(0,160)">
<text x="0" y="10" font-family="monospace" white-space="pre">0123456789x</text>
<text x="0" y="30" font-family="monospace" white-space="pre">01 45 89x</text>
<text x="0" y="50" font-family="monospace" white-space="pre"> 23 67 x</text>
<text x="0" y="70" font-family="monospace" white-space="pre"> x</text>
</g>
<g transform="translate(0,260)">
<text x="0" y="10" font-family="monospace" style="white-space:pre;">0123456789x</text>
<text x="0" y="30" font-family="monospace" style="white-space:pre;">01 45 89x</text>
<text x="0" y="50" font-family="monospace" style="white-space:pre;"> 23 67 x</text>
<text x="0" y="70" font-family="monospace" style="white-space:pre;"> x</text>
</g>
</svg>
<svg viewBox="0 0 400 800" style="width:400px">
<line x1="0" y1="0" x2="400" y2="0" stroke="black" />
<line x1="0" y1="0" x2="0" y2="400" stroke="black" />
<style>
text {
font-family:monospace;
white-space:pre;
}
</style>
<g transform="translate(0,10)">
<text x="0" y="10">abcdefghijklmn</text>
<text x="0" y="30">0123456789x</text>
<text x="0" y="50">01 45 89x</text>
<text x="0" y="70"> 23 67 x</text>
<text x="0" y="90"> x</text>
</g>
</svg>