SVG.text自动换行

一、(20180530)目前查到的资料,说 SVG自身 尚未 文字自动换行的功能html

二、资料:segmentfault

  2.一、xml - Auto line-wrapping in SVG text - Stack Overflow.html(https://stackoverflow.com/questions/4991171/auto-line-wrapping-in-svg-textapp

  2.二、请问SVG text怎么设置字体大小?怎么换行? - LeslieHoward的回答 - SegmentFault 思否.html(https://segmentfault.com/q/1010000008426252/a-1020000008428672svg

  2.三、大概相似的代码为:测试

<svg xmlns="http://www.w3.org/2000/svg" style="outline: 1px solid red;margin: 50px;">
    <switch>
        <foreignObject x="20" y="0" width="150" height="200" style="outline: 1px solid blue;">
            <p xmlns="http://www.w3.org/1999/xhtml">Text goes here, Text goes here, Text goes here, Text goes here</p>
        </foreignObject>
                
        <text x="20" y="20">Your SVG viewer cannot display html.</text>
    </switch>
</svg>

 

三、测试(20180619)字体

<switch>
    <foreignObject x="0" y="0" width="1500" height="2000" style="outline: 1px solid blue;">
        <p xmlns="http://www.w3.org/1999/xhtml">Text goes here, Text goes here, Text goes here, Text goes here.东<br/><br/><br/><br/><br/><br/>04</p>
        <font xmlns="http://www.w3.org/1999/xhtml" face="黑体" color="red"><br/><br/><br/><br/><br/><br/>04</font>
        <html xmlns="http://www.w3.org/1999/xhtml"><br/><br/><br/><br/><br/><br/>04</html>
东
怡
变
04
    </foreignObject>
    
    <text x="20" y="20">Your SVG viewer cannot display html.</text>
</switch>

  ZC:(1)、文字外面不加 <p/>或<font/>或<html/>等等 的话,没有办法识别<br/>(直接用 回车 也不行)spa

  ZC:(2)、<p/>、<font/>、<html/> 的属性“xmlns="http://www.w3.org/1999/xhtml"” 是必须的,若是没有 则文字是看不见的code

四、xml

五、htm

相关文章
相关标签/搜索