0

I am working on a HTML5 project. I have created a rectangle using ctx.strokeRect(x,y,width,height). Also also filling text using ctx.fillText(textValue,x,y).But text floating outside the boundary. i want to keep all the text within the rectangle boundary using javascript as happen in TextArea (i.e. when we resize textarea then text wraps inside boundary)

Thanks in advance.

Shanky
  • 201
  • 1
  • 4
  • 16
  • http://stackoverflow.com/questions/1134586/how-can-you-find-the-height-of-text-on-an-html-canvas and for wrapping http://stackoverflow.com/questions/2936112/text-wrap-in-a-canvas-element – SMathew Jul 17 '12 at 04:49
  • but these answers are not exactly wrap the text. In Ist ctx.mozDrawText('gM'); // This seems like tall text... Doesn't it? giving an error. – Shanky Jul 17 '12 at 05:19
  • @Shanky did you get to wrap the text within the rect boundaries? I'm facing a similar problem – joe Apr 02 '18 at 03:36

0 Answers0