From 2300d2813a524cbfeabac794335e7abe99263df6 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 29 Dec 2015 23:10:50 -0500 Subject: initial commit --- findfont.pl | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 findfont.pl (limited to 'findfont.pl') diff --git a/findfont.pl b/findfont.pl new file mode 100644 index 0000000..ead5392 --- /dev/null +++ b/findfont.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl -w + +# we're looking for this: + +# 00111000 +# 01000100 +# 10101000 +# 10100000 +# 10100000 +# 01000100 +# 00111000 + +#@want = ( +#0b10101000, +#0b10100000, +#); + +@want = ( +0b00000101, +0b00000101, +); + +#@want = ( +#0b00111000, +#0b01000100, +#0b10101000, +#0b10100000, +#0b10100000, +#0b01000100, +#0b00111000, +#); + +# or possibly a version of it shifted 1 or 2 bits to the right + +undef $/; +$img = <>; +@bytes = map { ord($_) } split //, $img; +for($i = 0; $i < @bytes - 7; $i++) { + my $found = 1; + for($j = 0; $j < @want; $j++) { + if($bytes[$i+$j] != $want[$j]) { + $found = 0; + } + } + if($found) { + printf "offset: %x\n", $i; + } +} + -- cgit v1.2.3