Subject: Re: vs4k60 font
To: None <port-vax@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-vax
Date: 02/16/2004 05:17:58
>> [...] the ROM font on a vs4k model 60.  I've extracted the font and
>> converted it to BDF format, so [...]
> What method did you use to extract the fonts?

sh -c 'o=117536; ( count from 32 to 126 ; count from 160 to 255 ) | cvtbase d x | while read x; do ( echo P4 ; echo 16 21 ; skipcat $o 42 < rom.bin | bitrev ) | pnmcut 0 0 12 21 > c/$x; o=$(($o+42)); done'

117536 was determined approximately by inspecting the file and in
detail by experimenting with a few values.

I then converted the per-character files generated by the above to a
BDF file with

sh -c 'cat bdf.head; ls c | while read cn; do cd=`echo $cn | cvtbase x d`; echo STARTCHAR $cn; echo ENCODING $cd; echo SWIDTH 1920 0; echo DWIDTH 12 0; echo BBX 12 21 0 -4; echo BITMAP; pnmnoraw < c/$cn | sed -e "1,2d" | cvtbase b x | sed -e "s/^/000/" -e '\''s/.*\(...\)$/\10/'\''; echo ENDCHAR; done; echo ENDFONT'

where bdf.head contained the stock beginning-of-font.  (This turns out
to have been slightly wrong; the BBX lines should end with -3 rather
than -4, something I fixed by editing the resulting file rather than
rerunning the above.)

I then used a BDF font editor I wrote long since to fix up the
character bounding boxes; I then copied it and used the same font
editor to turn it into the 8859-1 version.

Not that I expect that to be too useful to you, but you did ask. :)

As for the non-stock programs there:

count does just what it looks like.

cvtbase converts between bases; as used here, from decimal to hex in
the first command and from hex to decimal and from binary to hex in the
second command.

skipcat N M is just like cat except it skips N bytes, then copies at
most M bytes.

bitrev reverses the order of the bits in each byte.  (Implemented as a
shellscript which calls tr with two 240-character strings.  240 not 256
because 16 characters have symmetric bit-patterns and thus don't need
reversing.)

pnmcut is the stock netpbm pnmcut.

I'll be happy to send the source for these programs to anyone who
wants.  Except for pnmcut and the BDF file editor, they are also up for
anonymous ftp from ftp.rodents.montreal.qc.ca, count under
/mouse/local/src/count/, cvtbase and skipcat and bitrev in
/mouse/hacks/.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B