aboutsummaryrefslogtreecommitdiff
path: root/fonts/mkpsf.pl
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-27 05:30:54 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-27 05:30:54 -0400
commita11d325471be7ba147309f42148a9e16a6e82078 (patch)
tree6d5307486f798f663692e4697b170314ab84e171 /fonts/mkpsf.pl
parent1b5a2ec3a06abc75539d3f6e4b7ce9560567215f (diff)
downloadbw-atari8-tools-a11d325471be7ba147309f42148a9e16a6e82078.tar.gz
fonts: dotted box WIP. still not working.
Diffstat (limited to 'fonts/mkpsf.pl')
-rw-r--r--fonts/mkpsf.pl20
1 files changed, 14 insertions, 6 deletions
diff --git a/fonts/mkpsf.pl b/fonts/mkpsf.pl
index 8166c8a..b6c5532 100644
--- a/fonts/mkpsf.pl
+++ b/fonts/mkpsf.pl
@@ -109,7 +109,7 @@ sub read_rom {
# and 0x241b aka SYMBOL FOR ESCAPE).
sub setup_map {
our @map = (
- 0x0000,
+ 0x0000, # dotted-box (from char0.raw)
0x2665, # 0x00
0x2523, # 0x01
0x2503, # 0x02
@@ -434,8 +434,12 @@ setup_map();
@scale2 = ();
@scale3 = ();
-#$raw = read_rom("atarixl.rom", 0x2000, 128);
+# the dotted-box character has to come first in the BDF
+# font. or at least, the BDF has to say, up front, which
+# index (not unicode codepoint!) is the "default char", and
+# most fonts seem to use index 0 for this.
$raw = read_rom("char0.raw", 0, 1);
+
$raw .= read_rom("atarixl.rom", 0x2200, 32);
$raw .= read_rom("atarixl.rom", 0x2000, 32);
$raw .= read_rom("atarixl.rom", 0x2100, 32);
@@ -456,9 +460,7 @@ $raw .= read_rom("xe_arabic.rom", 0x2000+8*0x4f, 9);
$raw .= read_rom("xe_arabic.rom", 0x2000+8*0x59, 2);
$raw .= read_rom("xe_arabic.rom", 0x2000+8*0x60, 27);
$raw .= read_rom("xe_arabic.rom", 0x2000+8*0x7f, 1);
-#warn length($raw) / 8;
-##$raw = read_rom("arabicxe.rom", 0x2000, 128);
-#$cnt = 0x9a;
+
$cnt = 0;
while($raw =~ /(.{8})/gc) {
my @bytes;
@@ -489,10 +491,16 @@ while(<DATA>) {
#warn "(padding to 256 characters)\n" unless $cnt >= 256;
#warn "(padding to 512 characters)\n" unless $cnt >= 512;
+# 512 glyphs is the max for a PSF font. There can be more
+# *codepoints*, because the Unicode directory allows the same
+# glyph to represent multiple codepoints (e.g. space and
+# non-breaking space).
if($cnt > 512) {
- die "$0: too many characters ($cnt > 512)";
+ die "$0: too many glyphs ($cnt > 512)";
}
+# The kernel refuses to load a font that isn't exactly
+# 256 or 512 glyphs, so we have to pad with junk glyphs.
while($cnt < 512) {
my $fake = "%\nUnicode: [0000];\nBitmap: ";
push @scale1, $fake . (("-" x 8) x 8) . "\n";