I put together a simple demo on jsfiddle, which shows how to do this with @ font-face: http://jsfiddle.net/zMKge/
Opera also has a simple tutorial on using <canvas> , including a text API, but I'm not cool enough to have two hyperlinks. :)
CSS
@font-face { font-family: 'KulminoituvaRegular'; src: url('http://www.miketaylr.com/f/kulminoituva.ttf'); }
JavaScript:
var ctx = document.getElementById('c').getContext('2d'); var kitty = new Image(); kitty.src = 'http://i954.photobucket.com/albums/ae30/rte148/891blog_keyboard_cat.gif'; kitty.onload = function(){ ctx.drawImage(this, 0,0,this.width, this.height); ctx.font = '68px KulminoituvaRegular'; ctx.fillStyle = 'orangered'; ctx.textBaseline = 'top'; ctx.fillText ('Keyboard Cat', 0, 270); };
miketaylr Apr 09 '10 at 18:26 2010-04-09 18:26
source share