Skip to content

Commit

Permalink
add random dir and canvas font test
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Mar 16, 2010
1 parent b7dd048 commit 7dc2f73
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions random/canvas_rotated_textfill.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<title>Canvas Rotated textFill</title>
<meta charset="utf-8">
</head>
<body>
<canvas id="test" width="500" height="500"></canvas>
<script type="text/javascript">
var canvas = document.getElementById('test');
var ctx = canvas.getContext('2d');
ctx.fillStyle = "rgba(0, 0, 0, 0.8)";
ctx.fillRect(0, 0, 700, 470);

ctx.fillStyle = "white";

for (var i = 7; i < 13; i += 0.5) {
var fontSpec = "" + i + "px monospace";
ctx.font = fontSpec;
ctx.fillText(fontSpec, 20, i * 35 - 220);
}

for (var i = 7; i < 13; i += 0.5) {
var fontSpec = "" + i + "px sans-serif";
ctx.font = fontSpec;
ctx.fillText(fontSpec, 200, i * 35 - 220);
}

for (var i = 7; i < 13; i += 0.5) {
var fontSpec = "" + i + "px serif";
ctx.font = fontSpec;
ctx.fillText(fontSpec, 370, i * 35 - 220);
}

for (var i = 7; i < 13; i += 0.5) {
var fontSpec = "" + i + "pt monospace";
ctx.font = fontSpec;
ctx.fillText(fontSpec, 20, i * 35);
}

for (var i = 7; i < 13; i += 0.5) {
var fontSpec = "" + i + "pt sans-serif";
ctx.font = fontSpec;
ctx.fillText(fontSpec, 200, i * 35);
}

for (var i = 7; i < 13; i += 0.5) {
var fontSpec = "" + i + "pt serif";
ctx.font = fontSpec;
ctx.fillText(fontSpec, 370, i * 35);
}
</script>
</body>
</html>

0 comments on commit 7dc2f73

Please sign in to comment.