index.html部分
绘制文字 type="text/css" href="style.css">
index.js部分
function init() {
var canvas=document.getElementById('canvas');
var ctx=canvas.getContext("2d");
ctx.textBaseline = 'top';
ctx.fillStyle="red";
ctx.font=" bold 34px 微软雅黑";
ctx.fillText("你好",100,150);
ctx.strokeStyle="blue";
ctx.font=" italic 40px 宋体";
ctx.strokeText("你好",100,200);
}