Initial commit
[0x.git] / php / dlf.php
blob48aa8421de8350823fa840195706bd5369c91b7f
1 <html>
2 <head>
3 <style>
4 #container {
5 font-size : 500%;
6 line-height : 1.125em;
7 padding-top : 2%;
8 padding-left : 2%;
9 font-family : dlf;
12 @font-face {
13 font-family : dlf;
14 src : url("DingbatsLiberationFestRegular_04.ttf");
16 </style>
17 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
18 </head>
19 <body>
21 <div id="container">
23 <?php
25 $dlf = array(0x26, 0x2602, 0x2606, 0x2609, 0x260a, 0x2612, 0x2618, 0x2619, 0x2629, 0x262a, 0x262e, 0x2633, 0x2634, 0x263c, 0x263e, 0x2647, 0x264d, 0x265e, 0x265f, 0x2667, 0x2668, 0x266a, 0x2670, 0x2676, 0x2682, 0x2689, 0x268b, 0x268f, 0x2691, 0x2695, 0x2696, 0x269e, 0x26a6, 0x26ab, 0x26ac, 0x26b0, 0x26b6, 0x26bd, 0x26be, 0x26c1, 0x26cf, 0x26d8, 0x26d9, 0x26da, 0x26e1, 0x26ef, 0x26f0, 0x26f6, 0x26fa, 0x26fe, 0x2706, 0x2709, 0x270f, 0x2710, 0x2716, 0x271b, 0x2723, 0x2726, 0x2736, 0x2738, 0x273c, 0x273d, 0x2742, 0x2743, 0x2752, 0x2756, 0x275b, 0x275d, 0x275e, 0x2762, 0x276a, 0x276c, 0x2770, 0x2771, 0x278e, 0x2790, 0x2796, 0x2799, 0x279a, 0x27ac, 0x27af, 0x27b5, 0x27b7, 0x27bc);
27 /**
28 * Writes text blocks of rows*columns size with characters from an array of
29 * codepoints. Some of the characters written are randomly-distributed spaces.
30 * @param array $codepoints an array of codepoints
31 * @param integer $columns number of characters per line
32 * @param integer $rows number of lines
34 function around_text_symbols($codepoints, $columns, $rows) {
35 for ($row = 1; $row <= $rows; $row++) {
36 $random_distributed_space = range(1, $columns);
37 shuffle($random_distributed_space);
38 array_splice($random_distributed_space, mt_rand(1, $columns));
39 for ($column = 1; $column <= $columns; $column++) {
40 if (in_array($column, $random_distributed_space)) {
41 print "&nbsp;";
42 } else {
43 $my_choice = array_rand($codepoints, 2);
44 print "&#x" . dechex($codepoints[$my_choice[0]]) . ";";
47 print "<br/>";
51 around_text_symbols($dlf, 10, 8);
56 </div>
58 </body>
59 </html>