-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathcanvas_rotated_textfill.html
54 lines (47 loc) · 1.5 KB
/
canvas_rotated_textfill.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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>