第六章 文字
<canvas id
="canvas" height
="600" width
="600"></canvas
>
<script
>
var elem
=document
.getElementById("canvas");
var canvas
=elem
.getContext("2d");
canvas
.font
="bold 24px 黑体";
canvas
.textBaseli
ne
="top";
canvas
.textBaseline
="hanging";
canvas
.fillText("文字",100,100);
var size
=canvas
.measureText("文字");
canvas
.strokeRect(100,93,size
.width
,32);
</script
>
转载请注明原文地址:https://blackberry.8miu.com/read-288.html