HTML5 canvas ctx.fillText won't do line breaks?

前端 未结 17 1081
甜味超标
甜味超标 2020-11-28 01:37

I can\'t seem to be able to add text to a canvas if the text includes \"\\n\". I mean, the line breaks do not show/work.

ctxPaint.fillText(\"s  ome \\n \\\\n         


        
17条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 02:06

    I don't think this is possible neither, but a workaround for this is to create a

    element and position it with Javascript.

提交回复
热议问题