aboutsummaryrefslogtreecommitdiff
path: root/src/col80_modified/font2xbm.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/col80_modified/font2xbm.pl')
-rw-r--r--src/col80_modified/font2xbm.pl48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/col80_modified/font2xbm.pl b/src/col80_modified/font2xbm.pl
new file mode 100644
index 0000000..c0ec3be
--- /dev/null
+++ b/src/col80_modified/font2xbm.pl
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+
+use bytes;
+
+$name = "xbm";
+$width = 8;
+$height = 384;
+#$height = 512;
+$cwidth = $width / 8;
+$cheight = $height / 8;
+
+print <<EOF;
+#define ${name}_width ${width}
+#define ${name}_height ${height}
+static unsigned char ${name}_bits[] = {
+EOF
+
+undef $/;
+$_ = <>;
+@inbytes = split "";
+
+# reverse bits, print 12 bytes/line
+
+$c = 0;
+for($i=0; $i<@inbytes; $i++) {
+ $byte = ord $inbytes[$i];
+ if(!$c) {
+ print " ";
+ }
+
+ printf "0x%02x", reverse_bits($byte);
+ if($i != $#inbytes) {
+ if($c == 12) {
+ print ",\n";
+ $c = 0;
+ } else {
+ print ", ";
+ $c++;
+ }
+ }
+}
+
+print " };\n";
+
+sub reverse_bits {
+ my $bitstr = reverse sprintf("%08b", $_[0]);
+ return eval "0b$bitstr";
+}