From fd7a9382504720f77ecf3f40e9fb982da1e913a5 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 24 Jul 2024 03:34:33 -0400 Subject: fonts: WIP. --- Makefile | 5 ++++- fonts/fauxtari-16.psf | Bin 17954 -> 17966 bytes fonts/fauxtari-16.txt | 18 ++++++++-------- fonts/fauxtari-24.psf | Bin 38434 -> 38446 bytes fonts/fauxtari-24.txt | 24 ++++++++++----------- fonts/fauxtari-8.psf | Bin 5666 -> 5678 bytes fonts/fauxtari-8.txt | 12 +++++------ fonts/mkpsf.pl | 58 ++++++++++++++++++++++++++++---------------------- 8 files changed, 63 insertions(+), 54 deletions(-) diff --git a/Makefile b/Makefile index 3057bb0..7a18057 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ RST2MAN=rst2man # "make clean" and "make distclean" will not delete the 6502 object # code (the *.bin files), but "make realclean" will. -all: $(BINS) manpages symlinks subdirs +all: $(BINS) manpages symlinks subdirs fonts/fauxtari-8.psf unprotbas: bas.o @@ -185,6 +185,9 @@ manpages: $(MANS) $(MAN5S) $(MAN7S) %.7: %.rst manhdr7.rst manftr.rst $(RST2MAN) $< > $@ +fonts/fauxtari-8.psf: fonts/mkpsf.pl + ( cd fonts && perl mkpsf.pl ) + # "make clean" does NOT remove the .bin or _bin.[ch] files. This is # for people who don't have either dasm or atasm installed. # also, it doesn't remove the man pages. these are checked into git, even. diff --git a/fonts/fauxtari-16.psf b/fonts/fauxtari-16.psf index 6235056..9a9d06d 100644 Binary files a/fonts/fauxtari-16.psf and b/fonts/fauxtari-16.psf differ diff --git a/fonts/fauxtari-16.txt b/fonts/fauxtari-16.txt index 791857f..48d0e8e 100644 --- a/fonts/fauxtari-16.txt +++ b/fonts/fauxtari-16.txt @@ -357,7 +357,7 @@ Bitmap: \ -------------------------------- \ -------------------------------- % -Unicode: [0020]; +Unicode: [0020];[00a0]; Bitmap: \ -------------------------------- \ -------------------------------- \ @@ -500,7 +500,7 @@ Bitmap: \ ------####------------####------ \ ----####------------####-------- % -Unicode: [002d]; +Unicode: [002d];[00ad];[2013];[2014]; Bitmap: \ -------------------------------- \ -------------------------------- \ @@ -3089,16 +3089,16 @@ Bitmap: \ ---------------- % // degrees -Unicode: [00b0]; +Unicode: [00b0];[00ba]; Bitmap: \ ---------------- \ ---------------- \ - ------XX------ \ - ------XX------ \ - ----x----x---- \ - ----x----x---- \ - ------xx------ \ - ------xx------ \ + ------####------ \ + ------####------ \ + ----##----##---- \ + ----##----##---- \ + ------####------ \ + ------####------ \ ---------------- \ ---------------- \ ---------------- \ diff --git a/fonts/fauxtari-24.psf b/fonts/fauxtari-24.psf index 82cfc3c..75caa2f 100644 Binary files a/fonts/fauxtari-24.psf and b/fonts/fauxtari-24.psf differ diff --git a/fonts/fauxtari-24.txt b/fonts/fauxtari-24.txt index d74357b..6114e67 100644 --- a/fonts/fauxtari-24.txt +++ b/fonts/fauxtari-24.txt @@ -357,7 +357,7 @@ Bitmap: \ ------------------------------------------------------------------------ \ ------------------------------------------------------------------------ % -Unicode: [0020]; +Unicode: [0020];[00a0]; Bitmap: \ ------------------------------------------------------------------------ \ ------------------------------------------------------------------------ \ @@ -500,7 +500,7 @@ Bitmap: \ ---------######------------------######------------------######--------- \ ------######------------------######------------------######------------ % -Unicode: [002d]; +Unicode: [002d];[00ad];[2013];[2014]; Bitmap: \ ------------------------------------------------------------------------ \ ------------------------------------------------------------------------ \ @@ -3161,20 +3161,20 @@ Bitmap: \ ------------------------ % // degrees -Unicode: [00b0]; +Unicode: [00b0];[00ba]; Bitmap: \ ------------------------ \ ------------------------ \ ------------------------ \ - ---------XX--------- \ - ---------XX--------- \ - ---------XX--------- \ - ------x------x------ \ - ------x------x------ \ - ------x------x------ \ - ---------xx--------- \ - ---------xx--------- \ - ---------xx--------- \ + ---------######--------- \ + ---------######--------- \ + ---------######--------- \ + ------###------###------ \ + ------###------###------ \ + ------###------###------ \ + ---------######--------- \ + ---------######--------- \ + ---------######--------- \ ------------------------ \ ------------------------ \ ------------------------ \ diff --git a/fonts/fauxtari-8.psf b/fonts/fauxtari-8.psf index d115faf..822efa2 100644 Binary files a/fonts/fauxtari-8.psf and b/fonts/fauxtari-8.psf differ diff --git a/fonts/fauxtari-8.txt b/fonts/fauxtari-8.txt index f2434a7..5722a31 100644 --- a/fonts/fauxtari-8.txt +++ b/fonts/fauxtari-8.txt @@ -357,7 +357,7 @@ Bitmap: \ -------- \ -------- % -Unicode: [0020]; +Unicode: [0020];[00a0]; Bitmap: \ -------- \ -------- \ @@ -500,7 +500,7 @@ Bitmap: \ ---##--- \ --##---- % -Unicode: [002d]; +Unicode: [002d];[00ad];[2013];[2014]; Bitmap: \ -------- \ -------- \ @@ -3017,12 +3017,12 @@ Bitmap: \ -------- % // degrees -Unicode: [00b0]; +Unicode: [00b0];[00ba]; Bitmap: \ -------- \ - ---XX--- \ - --x--x-- \ - ---xx--- \ + ---##--- \ + --#--#-- \ + ---##--- \ -------- \ -------- \ -------- \ diff --git a/fonts/mkpsf.pl b/fonts/mkpsf.pl index 1ff5816..e3e9295 100644 --- a/fonts/mkpsf.pl +++ b/fonts/mkpsf.pl @@ -158,7 +158,7 @@ sub setup_map { 0x002A, # 0x2A 0x002B, # 0x2B 0x002C, # 0x2C - [ 0x002D, 0x00ad, 0x2013, 0x2014 ] # 0x2D (plus soft hyphen, en, em) + [ 0x002D, 0x00ad, 0x2013, 0x2014 ], # 0x2D (plus soft hyphen, en, em) 0x002E, # 0x2E 0x002F, # 0x2F 0x0030, # 0x30 @@ -466,7 +466,7 @@ while($raw =~ /(.{8})/gc) { my @bytes; my $got = $1; my $chr = $map[$cnt++]; - die "incomplete map" unless defined $chr; + die "$0: incomplete map" unless defined $chr; #warn $got; push @bytes, ord(substr($got, $_, 1)) for(0..7); #warn $_ for @bytes; @@ -487,9 +487,14 @@ while() { } } -warn "$cnt characters\n"; +#warn "$cnt characters\n"; #warn "(padding to 256 characters)\n" unless $cnt >= 256; -warn "(padding to 512 characters)\n" unless $cnt >= 512; +#warn "(padding to 512 characters)\n" unless $cnt >= 512; + +if($cnt > 512) { + die "$0: too many characters ($cnt > 512)"; +} + while($cnt < 512) { my $fake = "%\nUnicode: [0000];\nBitmap: "; push @scale1, $fake . (("-" x 8) x 8) . "\n"; @@ -497,25 +502,26 @@ while($cnt < 512) { push @scale3, $fake . (("-" x 24) x 24) . "\n"; $cnt++; } -warn "$cnt characters with padding\n"; - -open $fh, '>', "$fontname-8.txt" or die $!; -print $fh psf2txt_header($cnt, 1); -print $fh $_ for(@scale1); -close $fh; -system("txt2psf $fontname-8.txt $fontname-8.psf"); - -open $fh, '>', "$fontname-16.txt" or die $!; -print $fh psf2txt_header($cnt, 2); -print $fh $_ for(@scale2); -close $fh; -system("txt2psf $fontname-16.txt $fontname-16.psf"); - -open $fh, '>', "$fontname-24.txt" or die $!; -print $fh psf2txt_header($cnt, 3); -print $fh $_ for(@scale3); -close $fh; -system("txt2psf $fontname-24.txt $fontname-24.psf"); + +#warn "$cnt characters with padding\n"; +sub mkfonts { + my $px = shift; + my $scaled_data = shift; + my $scale = shift; + + open $fh, '>', "$fontname-$px.txt" or die $!; + print $fh psf2txt_header($cnt, $scale); + print $fh $_ for(@$scaled_data); + close $fh; + system("txt2psf $fontname-$px.txt $fontname-$px.psf"); + system("psf2bdf --iso10646 --fontname=$fontname-$px $fontname-$px.psf $fontname-$px.bdf"); +} + +mkfonts(8, \@scale1, 1); +mkfonts(16, \@scale2, 2); +mkfonts(24, \@scale3, 3); + +exit 0; __DATA__ % @@ -630,9 +636,9 @@ Bitmap: \ Unicode: [00b0];[00ba]; Bitmap: \ -------- \ - ---XX--- \ - --x--x-- \ - ---xx--- \ + ---##--- \ + --#--#-- \ + ---##--- \ -------- \ -------- \ -------- \ -- cgit v1.2.3