From a11d325471be7ba147309f42148a9e16a6e82078 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 27 Jul 2024 05:30:54 -0400 Subject: fonts: dotted box WIP. still not working. --- fonts/mkpsf.pl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'fonts/mkpsf.pl') 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() { #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"; -- cgit v1.2.3