Canvasに文字を描くの巻。
HTML
<canvas id='canvas'></canvas> |
JavaScript
var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); context.fillStyle = "#000000"; context.font = "italic bold 40px serif"; context.textBaseline = "top"; context.fillText('Hello world', 200, 60); |
font
文字属性指定, CSS形式で良さげ。
textBaseline
top, hanging, middle, alphabetic, ideographic, bottom
fillText
fillText(text:String, x position:int, y position:int [, max length:int])