This is an update to Simon Tatham's font utilities found here:
Some additional information on his work can be found here:
In brief, mkwinfont and dewinfont are Python scripts for working with Windows bitmap font file types: FNT and FON.
These scripts read from and write to text files (*.fd) where the character bitmaps are defined with text characters such a . and x, or 0 and 1 (or any combination of those).
For example, the letter "A":
char 65
width 9
.........
.........
.........
...xx....
...xx....
..xxxx...
..x..x...
.xx..xx..
.xx.xxx..
.xxxx.x..
xxx...xx.
xx....xx.
xx....xx.
.........
.........
.........
To make a FNT file from an FD source file:
python -m winfont.mkwinfont -o outfile.fnt file.fd
To make a FON file from one or more FD source files:
python -m winfont.mkwinfont -o outfile.fnt file1.fd file2.fd ...
--facename <name>is required if the FD files have different facenames defined within them. Optional otherwise.
To deconstruct either a FNT file or a single-font FON file to an FD source file:
python -m winfont.dewinfont -o outfile.fd filename.fon
To deconstruct a multi-font FON file to multiple FD source files:
python -m winfont.dewinfont --prefix out file.fon
- Files will be named like so:
<prefix>00.fd
winfont-fon2vector turns each bitmap strike in a FON/FNT file into a
pixel-exact vector font. Glyph bitmaps become merged rectilinear outlines
snapped to the pixel grid, and the metrics reproduce GDI's TEXTMETRIC, so
rendering at a font size that is an integer multiple of the strike's em size
is indistinguishable from the original bitmap. Every generated font is
verified by rasterizing its outlines back and diffing against the source.
This needs the optional fonttools dependency (plus brotli for WOFF2),
installed via the vector extra:
pip install "winfont[vector]"
winfont-fon2vector --out dist file.fon
- Each strike is emitted as its own font family (a bitmap strike is locked to one pixel size), with the point size — and, for non-96-dpi strikes, the resolution — folded into the family name.
--format ttf,woff,woff2selects output formats (default: all three).--face "<name>"converts only strikes with that face name.--synthesize-boldalso emits a GDI-style synthetic bold for each strike.--no-verifyskips the pixel-exact verification pass.
The font's charset is honored when mapping bytes to Unicode (e.g. an OEM strike is read as CP437), so box-drawing and other high-range glyphs land on the right codepoints.
FontForge - This is probably the most current editor. Weirdly, however, I haven't tested it much for FNT and FON work other than to open some multi-font FON files with it to see if it can handle them. It can. The interface, however, is so crazy complicated due to its vector features that it is hard to recommend it just for bitmap work. Use it if you already know it from vector work. Note that even though this is a vector-first editor, it only supports outline vectors and not single-line vectors (such as the "plotter" fonts found in some FON files).
fony - For most work, you'll probably want to use this editor. It is a fairly good editor with only a few UI annoyances. It has a few issues that forced me to revert to mkwinfont here and there, but those are rare. I also had some trouble with saving multi-font FON files as FNT (the FNT file coming out identical to the FON file, which is wrong) and reducing multi-font FON files to a single-font FON file (the result not readable by Windows)... but I can't reliably reproduce those problems either so, go figure, maybe it was me. Considering that FNT files are resource files for programming and not installable in the OS, and that FNT files cannot contain more than one font like FON files can (which this editor favors features for), it would probably make more sense to handle FNT as another type of import/export instead of a load/save. The feature to export to grid images is broken (which is fairly disappointing to me)... or was never completed (the latest version I found being a "work in progress"). That's what ImageMagick's montage tool is for, I suppose. Hint:
montage \
t_?.png \
t_??.png \
t_???.png \
-tile 32x -geometry "9x16<+0+0" -background white \
- \
| magick - -bordercolor white -border 4x2 \
t_montage.pngVSoft's Fontedit - This FNT-only editor still works on the latest Windows versions except for one very important feature: a bug prevents it from saving on the latest Windows. The source code is provided so it should be an easy fix. This is not as nice an editor as fony but it has some features fony should absorb, like: inserting and deleting of columns and rows, and selection editing.
PSF Tools - A collection of UNIX tools for converting many bitmap font types -- particularly, Linux's PSF console type (but not the PCF X11 type?). It installed fine in Babun/Cygwin for me.
It's been a long time since I've worked with these (some of which can also be contained in FON files), but here's a good reference:
Also, this discussion about the unlikely possibility of supporting some of these formats in FontForge:
See my guide for creating pixelated TrueType fonts in FontForge.
This project was spawned by needs of this other one for creating fonts compatible with PICO-8 programming: