1 | #!/usr/bin/perl |
---|
2 | # |
---|
3 | # script to create HTML file with character table |
---|
4 | # in plain, italic, bold, bold-italic |
---|
5 | # |
---|
6 | # see COPYRIGHT |
---|
7 | # |
---|
8 | |
---|
9 | # width of tables |
---|
10 | $step=16; |
---|
11 | |
---|
12 | # commands to enable and disable the font modes |
---|
13 | # (the fastest changing is first) |
---|
14 | @matrix = ( |
---|
15 | [ "Roman", "Italic", "</i>", "<i>" ], |
---|
16 | [ "Medium", "Bold", "</b>", "<b>" ], |
---|
17 | [ "Variable", "Fixed", "</tt>", "<tt>" ], |
---|
18 | ); |
---|
19 | |
---|
20 | sub printall |
---|
21 | { |
---|
22 | local $i, $j; |
---|
23 | |
---|
24 | printf("<table border=\"0\" >\n"); |
---|
25 | for($j=32; $j<256; $j+=$step) { |
---|
26 | printf("<tr>\n"); |
---|
27 | for $i ($j..$j+$step-1) { |
---|
28 | $c=chr($i); |
---|
29 | if($c eq "<") { |
---|
30 | $c="<"; |
---|
31 | } elsif($c eq ">") { |
---|
32 | $c=">"; |
---|
33 | } |
---|
34 | printf("<td><font color=\"gray\">%03d</font></td><td>\n", $i); |
---|
35 | printf("<font color=\"white\">%s%s%s</font>\n", $enmode, $c, $dismode); |
---|
36 | printf("</td>\n"); |
---|
37 | } |
---|
38 | printf("</tr>\n"); |
---|
39 | } |
---|
40 | printf("</table><p>\n"); |
---|
41 | } |
---|
42 | |
---|
43 | printf("<HTML><HEAD></HEAD><BODY bgcolor=\"black\">\n<font color=\"white\"><p>\n"); |
---|
44 | |
---|
45 | for $mask (0.. (1<<@matrix)-1) { |
---|
46 | #printf("<table><tr>"); |
---|
47 | $mode = $enmode = $dismode = ""; |
---|
48 | for $bit (0.. $#matrix) { |
---|
49 | $val = ($mask >> $bit) & 1; |
---|
50 | $mode = $matrix[$bit]->[$val] . "<br>" . $mode; |
---|
51 | if( $val ) { |
---|
52 | $enmode = $matrix[$bit]->[3] . $enmode; |
---|
53 | $dismode = $dismode . $matrix[$bit]->[2]; |
---|
54 | } |
---|
55 | #printf("=== %d %s %s %s\n", $val, $mode, $enmode, $dismode); |
---|
56 | } |
---|
57 | #printf("%x %s %s %s\n", $mask, $mode, $enmode, $dismode); |
---|
58 | printf("<table border=\"0\"><tr><td>\n"); |
---|
59 | &printall(); |
---|
60 | printf("</td><td valign=top><font size=\"+1\" color=\"yellow\"><b>\n"); |
---|
61 | printf("%s\n", $mode); |
---|
62 | printf("</b></font></td></tr></table>\n"); |
---|
63 | } |
---|
64 | |
---|
65 | printf("</font></BODY></HTML>\n"); |
---|