From 2973d0c78e9b8eed3c5af239927c6bd36af64604 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 13 Mar 2019 02:50:42 -0400 Subject: initial commit --- src/col80_modified/font2xbm.pl | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/col80_modified/font2xbm.pl (limited to 'src/col80_modified/font2xbm.pl') 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 <; +@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"; +} -- cgit v1.2.3