aboutsummaryrefslogtreecommitdiff
path: root/findfont.pl
diff options
context:
space:
mode:
Diffstat (limited to 'findfont.pl')
-rw-r--r--findfont.pl49
1 files changed, 49 insertions, 0 deletions
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;
+ }
+}
+