Text wrap in a <canvas> element

Posted by Gwood on Stack Overflow See other posts from Stack Overflow or by Gwood
Published on 2010-05-29T18:16:51Z Indexed on 2010/05/29 19:22 UTC
Read the original article Hit count: 246

Filed under:
|
|

I am trying to add text on an image using the <canvas> element. First the image is drawn and on the image the text is drawn. So far so good.

But where I am facing a problem is that if the text is too long, it gets cut off in the start and end by the canvas. I don't plan to resize the canvas, but I was wondering how to wrap the long text into multiple lines so that all of it gets displayed. Can anyone point me at the right direction?

© Stack Overflow or respective owner

Related posts about text

Related posts about html5