Canvas Gradients Playground
HTML
<canvas id="canvas" width="600" height="600"></canvas>
CSS
canvas {
border: 1px red solid;
}
JavaScript
var ctx = document.getElementById('canvas').getContext('2d');
ctx.fillRect(10, 10, 100, 100);
ctx.font="30px Arial";
var txt="Hello World Hello, was geht. Ich bin der krasseste was geht bla blabal haoeuhaosuth taehuso hoanuhaou ohuntoeu snothueoathu aoneuhanoehu haonuhnatouhonuh tnaohusnatou";
console.log(ctx.measureText(txt).width,10,50);
ctx.fillText("width:" + ctx.measureText(txt).width,10,50)
ctx.fillText(txt, 10,100);