<html>
<head>
<script type="application/javascript">
function init() {
var canvas = document.getElementById("canvas");
if (canvas.getContext)
{
var ctx = canvas.getContext("2d");
// Specify the font size and font name
ctx.font = "15px verdana";
// Display the text at the specified location. In this case (5,20)
ctx.strokeText("Believe", 5,20);
}
}
</script>
<title>How to specify font for text on a canvas</title>
</head>
<body onload="init();">
<canvas id="canvas" width="900"
height="500"></canvas><br>
</body>
</html>
|