<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
<script type="text/javascript">
function init() {
setInterval(paint, 1000);
}
function paint() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = "rgba(255, 255, 255, 255)";
ctx.fillRect(0, 0, canvas.width, canvas.height);
var fontName= 'Ubuntu';//document.defaultView.getComputedStyle(canvas, null).fontFamily;
ctx.fillStyle= "rgba(0,0,0,255)";
ctx.font = "32px 'Helvetica'";
ctx.fillText("Helvetica Ubuntu", 10, 50);
ctx.font = "32px '"+fontName+"'";
ctx.fillText("Ubuntu Ubuntu", 10, 100);
ctx.font = "32px 'Times'";
ctx.fillText("Times Ubuntu", 10, 150);
}
</script>
</head>
<body onload="init();">
<canvas id='canvas' style="border:solid 1px;font-family:Ubuntu;" width="400" height="300"></canvas>
</body>
</html>
0 件のコメント:
コメントを投稿