Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add random dir and canvas font test

  • Loading branch information...
commit 7dc2f73d84892e4f55e49573fca85af898da81a6 1 parent b7dd048
@mojombo mojombo authored
Showing with 54 additions and 0 deletions.
  1. +54 −0 random/canvas_rotated_textfill.html
View
54 random/canvas_rotated_textfill.html
@@ -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.
Something went wrong with that request. Please try again.