Created
September 27, 2012 15:54
-
-
Save possan/3794772 to your computer and use it in GitHub Desktop.
Using Cufon fonts inside a <canvas> in Spotify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="cufon-yui.js" type="text/javascript"></script> | |
<script src="Raleway_Dots_400.font.js"></script> | |
</head> | |
<body> | |
<h1 id="h1">HELLO CUFON CANVAS!</h1> | |
<canvas id="a" width="200" height="200" style="background-color:#ccc;"></canvas> | |
<script type="text/javascript"> | |
Cufon.set('engine', 'canvas'); | |
Cufon.replace('h1'); | |
var h1 = document.getElementById('h1'); | |
console.log(h1); | |
var a = document.getElementById('a'); | |
var b = a.getContext('2d'); | |
b.lineColor = '#000'; | |
b.beginPath(); | |
b.moveTo(0,0); | |
b.lineTo(200,200); | |
b.stroke(); | |
setTimeout(function() { | |
var ic = document.querySelector('canvas'); | |
console.log(ic); | |
b.drawImage(ic, 0, 0); | |
},100); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment