1845828-1-ref.html (597B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <style> 4 @font-face { 5 font-family: test; 6 src: url("Ahem.ttf"); 7 } 8 </style> 9 <canvas id=c></canvas> 10 <script> 11 document.fonts.load("10px test").then(() => { 12 ctx = c.getContext("2d"); 13 ctx.scale(1, 1); 14 ctx.font = "10px test"; 15 ctx.fillText("10px test", 10, 20); 16 ctx.font = "11px test"; 17 ctx.fillText("11px test", 10, 40); 18 ctx.font = "12px test"; 19 ctx.fillText("12px test", 10, 60); 20 ctx.font = "13px test"; 21 ctx.fillText("13px test", 10, 80); 22 ctx.font = "14px test"; 23 ctx.fillText("14px test", 10, 100); 24 }); 25 </script>