Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 <html>
2 <script>
3 function load() {
4 var ctx = document.getElementById("canvas").getContext("2d");
6 ctx.font = "bold 12px sans-serif";
7 ctx.scale(4, 4);
8 var str = "HeHeHeHe";
9 var x = 0;
10 for (var i = 0; i < str.length; ++i) {
11 ctx.fillText(str[i], x, 15);
12 x += ctx.measureText(str[i]).width;
13 }
14 }
15 </script>
16 <body onload="load();">
17 <canvas id="canvas" width="400" height="200"></canvas>
18 </body>
19 </html>