);
if ($opt_help) {
- print << "END";
+ print << "END" or die ("Cannot print to stdout.\n");
Turn a .png glyph matrix into a GNU Unifont hex glyph set of 256 characters
#}
GD::Image->trueColor (1);
-$im = new GD::Image ("$input") or die ("Cannot open image\n");
+$im = new GD::Image ("$input") or die ("Cannot open image.\n");
if ($im->isTrueColor ()) {
$im->trueColorToPalette ();
$charheight = 16;
$charmaxwidth = 3;
} elsif ($im->rgb ($pixel) == ($white_red, $white_green, $white_blue)) {
- $charyoffset = 4;
- $charheight = 24;
+ $charyoffset = 7;
+ $charheight = 16;
$charmaxwidth = 3;
+#
+# Use the settings below for a height of 24 pixels in the future;
+# for now, hard code glyph height to 16 pixels.
+# $charyoffset = 4;
+# $charheight = 24;
+# $charmaxwidth = 3;
} else {
die ("Cannot determine font height\n")
}
$display_width = $codepoint > 0xFFFF ? 6 : 4;
if ($output) {
- open (HEXFILE, ">$output") or die ("Cannot save file\n");
+ open (HEXFILE, ">$output") or die ("Cannot save hex file.\n");
} else {
*HEXFILE = *STDOUT;
}
$char = $char . sprintf ("%0*X", $charwidth * 2, $line);
}
- print HEXFILE "$char\n";
+ print HEXFILE "$char\n" or die ("Cannot print to hex file.\n");
}
$codepoint += 1;
# Only close HEXFILE if it isn't mapped to STDOUT.
if ($output) {
- close HEXFILE;
+ close HEXFILE or die ("Cannot properly close hex file.\n");
}