OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <canvas id='c'></canvas> |
| 5 <script> |
| 6 var fontNameList = ["Palatino Linotype", "Georgia", "Times New Roman", "Arial",
"Arial Black", "cursive", "Impact", "Tahoma", "Helvetica", "Verdana", "Geneva",
"sans-serif", "Courier", "Monaco"] |
| 7 var fontStyleList = ["", "italic", "oblique"]; |
| 8 var fontWeightList = ["", "bold", "bolder", "lighter"]; |
| 9 var fontSizeList = ["10pt", "15pt", "20pt", "small", "large", "15px", "20mm"]; |
| 10 |
| 11 var canvas = document.getElementById("c"); |
| 12 var ctx = canvas.getContext("2d"); |
| 13 |
| 14 function doFrame() { |
| 15 var fontString; |
| 16 canvas.width = canvas.width; |
| 17 fontNameList.forEach(function(fontName) { |
| 18 fontStyleList.forEach(function(fontStyle) { |
| 19 fontWeightList.forEach(function(fontWeight) { |
| 20 fontSizeList.forEach(function(fontSize) { |
| 21 ctx.font = fontStyle + " " + fontWeight + " " + fontSize + "
" + fontName; |
| 22 // Use the font to make sure the font is completely resolved
(has no pending lazy inits) |
| 23 ctx.fillText("Test", 0, 50); |
| 24 }); |
| 25 }); |
| 26 }); |
| 27 }); |
| 28 requestAnimationFrame(doFrame); |
| 29 } |
| 30 requestAnimationFrame(doFrame); |
| 31 </script> |
| 32 </body> |
| 33 </html> |
OLD | NEW |