canvas字体样式

<canvas style="border: aqua solid 1px;" id='canvas' width='500' height='500'></canvas>
<script>
    var canvas = document.getElementById('canvas');
    context = canvas.getContext('2d');

    context.font = '38pt Arial'; //字体样式
    context.fillStyle = 'red'; //填充线样式
    context.strokeStyle='blue'; //轮廓线样式

    context.fillText("hellocav",100,100); //填充线
    context.strokeText("hellocav",100,100); //轮廓线
</script>

 

posted @ 2019-02-22 22:45  流浪匠人  阅读(4521)  评论(0编辑  收藏  举报