strokeTextメソッド
メソッド strokeText は、Canvas上にテキストのアウトラインを描画します。最初のパラメータは描画するテキストを受け取り、2番目と3番目はCanvas上のそのテキストの座標を受け取ります。サイズとフォントタイプは、プロパティ font を使用して設定します。
構文
コンテキスト.strokeRect(テキスト, x, y);
例
strokeRect を使用してテキストのアウトラインを描画し、サイズを 30px、タイプをArialに設定しましょう:
<canvas id="canvas" width="200" height="200" style="background: #f4f4f4;"></canvas>
let canvas = document.querySelector('#canvas');
let ctx = canvas.getContext('2d');
ctx.font = '30px Arial';
ctx.strokeText('Hello world', 30, 50);
: