下面是 SVG 代码,它显示了颠倒路径上的文本。请帮助展示如何正确显示它。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" xml:space="preserve">
<g>
<path id="link1" d="M 500,140 C 200,140 200,190 500,190" stroke-width="20" fill="transparent" stroke="red"></path>
<text class="text_path">
<textPath xlink:href="#link1" startOffset="10">
<tspan dy="5">Some Text</tspan><tspan class="dir_arrow">?</tspan>
</textPath>
</text>
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
因为您是从下到上绘制曲线,所以文本遵循绘制曲线的方向并且是“颠倒的”。
\n\n如果您想要以其他方式显示文本,则需要从上到下绘制曲线,以便绘图的方向与所需文本的方向相匹配。
\n\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="600px" height="600px">\r\n <g>\r\n <path id="link1" d="M 500,190 C 200,190 200,140 500,140" stroke-width="20" fill="transparent" stroke="red"></path>\r\n <text class="text_path">\r\n <textPath xlink:href="#link1" startOffset="370">\r\n <tspan dy="5" class="dir_arrow">\xe2\x86\x90</tspan><tspan>Some Text</tspan>\r\n </textPath>\r\n </text>\r\n </g>\r\n </svg>Run Code Online (Sandbox Code Playgroud)\r\n| 归档时间: |
|
| 查看次数: |
724 次 |
| 最近记录: |