1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <title>Canvas
2d Context Font Property Speed
</title>
7 <canvas id='thecanvas' height=
100 width=
100/>
9 var canvas
= document
.getElementById('thecanvas');
10 var context
= canvas
.getContext('2d');
12 for (var i
= 0; i
< 1000; i
++) {
14 context
.font
= 'bold 13px Arial';
16 context
.font
= 'italic 13px Arial';
18 alert('Elapsed for 1000 font switches: ' + (Date
.now() - t0
));