aboutsummaryrefslogtreecommitdiff
path: root/font/mkfont.pl
diff options
context:
space:
mode:
Diffstat (limited to 'font/mkfont.pl')
-rw-r--r--font/mkfont.pl78
1 files changed, 78 insertions, 0 deletions
diff --git a/font/mkfont.pl b/font/mkfont.pl
new file mode 100644
index 0000000..20c5ece
--- /dev/null
+++ b/font/mkfont.pl
@@ -0,0 +1,78 @@
+#!/usr/bin/perl -w
+
+use bytes;
+
+open $in, "</usr/share/atari800/atarixl.rom" or die $!;
+open $out, ">font.dat" or die $!;
+
+my $junk;
+read($in, $junk, 0x2000); # skip to the font
+
+read($in, $X2000, 256); # ASCII 32-63
+read($in, $X2100, 256); # ASCII 64-95
+read($in, $X2200, 256); # ASCII 0-31
+read($in, $X2300, 256); # ASCII 96=127
+
+# ASCII 0 is a blank glyph
+substr($X2200, 0, 8) = "\x00" x 8;
+
+$font = $X2200 . $X2000 . $X2100 . $X2300;
+
+while(<DATA>) {
+ chomp;
+ if(/^(\d+)$/) {
+ $offset = $1 * 8;
+ next;
+ } elsif(/^[-#]+$/) {
+ s/-/0/g;
+ s/#/1/g;
+ my $byte = eval "0b$_";
+ substr($font, $offset++, 1) = chr $byte;
+ }
+}
+
+print $out $font;
+
+close $in;
+close $out;
+
+__DATA__
+96
+--------
+--##----
+--##----
+---##---
+--------
+--------
+--------
+--------
+
+123
+----###-
+---##---
+---##---
+--##----
+---##---
+---##---
+----###-
+--------
+
+125
+-###----
+---##---
+---##---
+----##--
+---##---
+---##---
+-###----
+--------
+
+126
+--------
+-###--##
+##-##-##
+##--###-
+--------
+--------
+--------
+--------