The Sharp MZ-721 font in a terminal emulator

Long ago I made a LaTeX font out of the character glyphs from the Sharp MZ-721 8-bit microcomputer. Then I made a font for use in a terminal emulator. How did I do it? From the below, I seem to have used the pk file generated when the font was used in LaTeX, then realised I could go direct from the original Sharp character ROM. I made a bdf file, which is an old but usable format. You can download it from here, and the crap below will help you install it if you need help. But you can google ‘installing bdf fonts’ and get something more useful. And edit the fonts to make them better. Or not,. whatever.

I don’t remember any details. Here is the contents of a ‘note to self’ file I wrote at the time…


Installed gbdfed for AMD64 by downloading the following package:

Package: gbdfed (1.5-1.1)

squeeze (oldoldstable) (x11): X11 font editor 1.5-1.1: amd64 armel i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 sparc


$ sudo dpkg -i gbdfed_1.5-1.1_amd64.deb

and it seems to work. Opened the pk file for the first MZ font and then saved as bdf. That is all so far.

How to use a BDF font file…

move it to

$ cd .fonts
$ mkfontdir
$ cd mz
$ mkfontdir
$ chmod 644 *
$ xset fp+ $HOME/.fonts/mz
$ xset fp rehash

If I go to the.fonts/mz and type

xterm -fn -unknown-mz7cgint-medium-r-normal–83-100-600-600-p-530-fontspecific-0

it works but the font is enormous, since it is just mapped directly as
a 600x600 bitmap.  Needs to be resized... look at gbdfed again

OK, changed font ascent, x-ren and y-resn in properties to 24 instead of 600.

No diff.  Set point size to 12.

OK, use xfontsel to get an idea of sensible parameters.

Still too big --- maybe go back to metafont and try as low res device:
$ mf '\mode=epsfast; input MZ7CGint'

$ gftopk  MZ7CGint.60gf

open and save with no modifications. Move it to… ~/.fonts/mz/MZ7CGint.bdf


$ mkfontdir
$ xset fp rehash
$ cat fonts.dir
$ xterm -fn -unknown-mz7cgint-medium-r-normal--10-100-60-72-p-60-fontspecific-0

and all good. Note that I had to delete all coloured pixels in char20 (hex) since it was filling up the screen with triangles. Note also that this mode proved a bit small… went and had another look at and picked a mode a bit bigger, say about 100dpi…

$ mf '\mode=nextscrn; input MZ7CGint'

works pretty well. Font could do with some more leading. Play in font editor…
Problem is that we have an 8×8 font in a number of boxes that is not a multiple of 8. What other modes are there…

96 dpi? (atarins) — odd choices of blackened pixels.
120 (onetz)? — odd choices of blackened pixels.
120×144 (epswlo) — odd choices of blackened pixels.
144dpi lasf — odd choices of blackened pixels.
72×120 is epsdrft — nope
laserjet 300 dpi — nope
hifax 200dpi — looks great, but will font be huge?

Yes, it looks huge but works really well. Now, can we downsize it?

Now, fontforge can open the bdf file… That means one can make a PostScript font or similar… (maybe one day…)

$ sudo apt-get install bdfresize

$ bdfresize -f1/2 MZ7CGint.bdf > MZ7CGinthalf.bdf

OK, but not ideal. Problems with cursor not present when on a blank space… How is cursor chosen?

Anyway, the threequart(er) size one also looks excellent, since 24 and 28 have 4 as a common factor.

The cursor seems to be the empty space drawn in reverse, but it does not work here.

See ~/bin/mzterm … heh heh heh.

 cat  ~/bin/mzterm

rxvt -g 88x50 -cr white -pr white -bd blue -fg white -bg black -fn -unknown-mz7int1-medium-r-normal--16-160-72-72-c-240-fontspecific-0
#rxvt -g 88x50 -cr white -pr white -bd blue -fg white -bg black -fn -unknown-mz7cgintt-medium-r-normal--18-63-200-200-p-107-fontspecific-0 -e clearsh
#rxvt -cr white -pr white -bd blue -fg white -bg black -fn -unknown-mz7cgint-medium-r-normal--21-75-200-200-p-128-fontspecific-0 -e clearsh
#rxvt -cr white -pr white -bd blue -fg white -bg blue -fn -unknown-mz7cgint-medium-r-normal--21-75-200-200-p-128-fontspecific-0 -e clearsh
#xterm  -sb -leftbar -cr white -bd blue -fg white -bg blue -g 88x50 -fn -unknown-mz7int1-medium-r-normal--16-160-72-72-c-240-fontspecific-0

Still no cursor, though… don’t know why.

gdbfed can open the MZ-700 ROM directly as a console font…doofus.

Just need to put in an average width… BUT, the encoding is of course all over the shop.

Step 1 is to put out first half of the ROM to MZ7int1.ROM
Step 2 is to open this in gbdfed (console font)
Step 3 is to re-encode correctly:

$ mv MZ7int1.bdf MZ7int1_recode.bdf

Then change the encoding number in the file. I can’t be bothered right now. Easiest would be to use the re-encoding table I put into the C file for mz2mf to make the tex font… Done.

OK, play with scale of it using bdfresize — just 2 3 4x for now Done.

OK, these are the better fonts. No need to go via LaTeX. Just note it as possible and move on! Descenders are getting chopped off by the next line, but I don’t really care.

mzterm launches a terminal widow using the font. It is cute to do the white on blue look like the old machine, but directory names don’t look too good…

Translated all glyphs by 2 in Y to try to increase leading.

Copy to ~/.fonts/mz then cd there and mkfontdir etc

And here’s a picture….


Ugly or what? The old Sharp defaulted to white on blue, so how about this:

$ xterm -sb -leftbar -cr white -bd blue -fg white -bg blue -g 88x50 -fn -unknown-mz7int1-medium-r-normal--16-160-72-72-c-240-fontspecific-0 &


Oh, enough wastage.



Tags: , , , , , , , ,

About Darren

I'm a scientist by training, based in Australia.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: