You know it seemed like such an obvious thing, but I had to be reminded that in the real world, nothing is obvious. I'm currently working on code to translate positional information from a chess game into a typeset diagram. Like most things, not only is there more than one way to do it, but no one wants to be caught dead doing it the same way--chess fonts that is! The mapping of ASCII characters to font representation is fairly crucial if for instance 'N' doesn't map to 'N'! And in chess fonts, 'N' might map to a white knight on a white square, or maybe that was a 'little' 'n', or was that an 'S'? Clearly you can't see the layout of the land without a map, so I reached for my trusty font-mapper only to realize that I didn't have one--yes, I know you can get a sample just by double-clicking on the font name (W2k) but a sample is not a map. I needed them all, and if out of range of normal typeable text, I needed the octal code as well. What to do? Well gee Sparky, how about a little of that old Perl magic? To wit:
#!/usr/bin/perl # fontmap.pl -- Creates an HTML page of the desired font. use strict; use warnings; my $font = $ARGV[0]; my $c = 32; print <<TEXT; <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Font Map of $font</title> <meta name="Generator" content="Fontmap.pl"> <meta name="Keywords" content="FONT MAP"> <meta name="Description" content="A tabular HTML font map of '$font'." +> <style type="text/css"> td.font {font-family: "$font"} </style> </head> <body style="font-family:Arial"> <table style="font-size:12pt" border="1"> TEXT foreach (0..27) { print "\t<tr>\n"; foreach (0..7) { print "\t\t<td>",chr($c) eq ' ' ? '&nbsp;' : chr($c),"</td><td + class=\"font\">",chr($c) eq ' ' ? '&nbsp;' : chr($c),"</td><td>",spr +intf("%o",$c++),"</td>\n"; } print "\t</tr>\n"; } print <<TEXT; </table> </body> </html> TEXT

–hsm

"Never try to teach a pig to sing…it wastes your time and it annoys the pig."