Using a VGA font in LaTeX

LaTeX makes very nice documents —  why would anybody want to use a crude, 16 x 8 pixelated font?  Only to mimic a command line screen from a DOS or Windows CMD.exe ‘terminal’ window.

I have had a need to do this…

Some hunting around on CTAN found this:

http://tug.ctan.org/systems/msdos/vga2mf/

which uses a (relatively) simple C program to take VGA bitmaps of the characters in the old DOS VGA font and, basically by drawing a circle on each pixel, puts out a METAFONT file. I refer anyone who is interested to the documentation there.

F in VGAF in the VGA font…

The process whereby this was done and the files needed to implement the VGA ‘font’ can be obtained from http://djg.4t.com/vgafnt.tar.gz

Of course, most of the work was done by the author(s) of vga2mf.c, whose details can be found at the CTAN page noted above.

I should note that the font is only for upright roman and as I have done it only at standard text size. Asking for variants (bold, etc) will drop you into (most likely) computer modern of some kind.

I note also that the glyphs include the DOS graphics sprites, things like this:

Section glyph in VGA

and TeXing the file wnpc10.tex (available from the CTAN page noted above) will give you something like this:

 wnpc10

Where the raw TeX file has DOS ASCII characters in it beyond those that can be entered from the keyboard; the font generated from the file CP437.VGA is basically code page 437.  (See also here.) So this gives access to a reasonably wide range of characters.  Here is some more output.  This was obtained by using an old DOS word processor in DOSBox to type in some Greek, etc, characters,. then converting the file to ASCII.  The resulting file was embedded in a {\crtscreen ...Text here... } construction, and the resulting pdf file looks like this:

Random Characters in VGA

So a text screen dump from DOS can be typeset more or less as seen on the screen, which is what the original authors of the font were after.  Naughtily, I have just called the font ‘vgafont’.  I ought to call it something more correct in LaTeX naming, and probably with CP437 in the title to allow other code pages to be used; maybe one day.

 
More fonty.

Advertisements

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:

WordPress.com Logo

You are commenting using your WordPress.com 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: