aboutsummaryrefslogtreecommitdiff
path: root/findfont.pl
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2015-12-29 23:10:50 -0500
committerB. Watson <yalhcru@gmail.com>2015-12-29 23:10:50 -0500
commit2300d2813a524cbfeabac794335e7abe99263df6 (patch)
treed729ca4f99634788cbb3a2101a5b5854a4bc2d06 /findfont.pl
downloadtaipan-2300d2813a524cbfeabac794335e7abe99263df6.tar.gz
initial commit
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;
+ }
+}
+