-@@------------------------------------------@@------@@--------------@@-
-@@------------------------------------------@@------@@--@@----------@@-
-@@------------------------------------------@@----------@@----------@@-
-@@------@@@@@@@@@----@@@@---@@@@@----@@@@---@@@@@---@@-@@@@---------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@------@@-
-@@------@@--@@--@@---@@@@---@@--@@---@@@@---@@@@@---@@---@@-@@------@@-
-@@------------------------------------------------------------------@@-
-@@------------------------------------------------------------------@@-
-@@------------------------------------------------------------------@@-
Tools for working with monochrome bitmap fonts
The monobit
tools let you modify bitmap fonts and convert between several formats.
monobit
's native format is yaff
, a human-friendly, text-based visual format similar to the ones used by Roman Czyborra's hexdraw
, Simon Tatham's mkwinfont
and John Elliott's psftools
. Details are given in the yaff
font file format specification.
Monobit requires Python 3.9 or above. Install through pip install monobit
. Some formats or features require additional packages; see Dependencies below for a list. These will be installed automatically if you use pip
.
monobit
can be used as a Python package or as a command-line tool.
Here are some examples of how to use the conversion utility.
monobit-convert --help
Display usage summary and command-line options
monobit-convert --help load --format=raw
Display usage summary and additional format-specific command-line options for conversion from raw binary.
monobit-convert fixedsys.fon
Recognise the source file format from "magic bytes" or suffix (here, a Windows font) and write fonts to standard output in yaff
format.
monobit-convert roman.bdf to --format=unifont
Read font from BDF file and write to standard output as Unifont HEX.
monobit-convert fixed.psf to fixed.png
Read font in PSF format and write to disk as image in PNG format.
monobit-convert --format=c to --format=bdf
Read font from standard input as C-source coded binary and write to standard output as BDF.
The converter transparently reads and writes gz
, bz2
, or xz
-compressed font files and can read and write zip
and tar
archives. Some font formats contain multiple fonts whereas others can contain only one; the converter will write multiple files to a directory or archive if needed.
It is also possible to apply various transformations on the font before saving it. Check monobit-convert --help
for usage.
The banner utility renders text to standard output in a given font. This is similar to the ancient banner
commands included in System-V and BSD Unixes.
For example, the banner at the top of this README
was made with
me@bandit:~$ monobit-banner '| monobit. |' --font=VGASYS.FON
monobit-banner
has a number of rendering options - you can choose fonts, change the "ink" and "paper" characters, set a margin, scale text, and rotate by quarter turns. Check monobit-banner --help
for usage.
alto
.al
✓ binary - Amiga Font Contents amiga-fc
.font
✓ ✓ binary M; see amiga
Amiga font amiga
✓ ✓ binary O C G X11/Adobe BDF bdf
.bdf
✓ ✓ coded U SB MB V O G BeOS Bitmap Font beos
✓ ✓ binary U O G Xerox Alto BITBLT bitblt
.strike
.ks
✓ binary O AngelCode BMFont [P] bmfont
.fnt
.xml
.json
+ images ✓ ✓ image M U SB MB O K G C FONTRIX (PC), PCPaint, GRASP, ChiWriter chiwriter
.set
.[specx]ft
✓ binary - Consoleet / vfontas consoleet
.txt
✓ ✓ visual - Daisy-Dot daisy
.nlq
.nl2
.nl3
.nl4
✓ binary - DosStart! dosstart
.dsf
✓ ✓ coded - EDWIN bitmap font edwin
.fnt
✓ ✓ coded - Figlet font figlet
.flf
✓ ✓ visual (3) FZX font fzx
.fzx
✓ ✓ binary O OS/2 GPI resource gpi
.fnt
✓ binary SB O (MB K) Atari GDOS / GEM gdos
.fnt
.gft
.vga
✓ ✓ binary O GEOS font file (CVT) geos
.cvt
✓ ✓ binary M; see vlir
Adafruit GFX font gfxfont
.h
✓ ✓ coded O hexdraw hexdraw
.draw
✓ ✓ visual U HP PCL soft font hppcl
.sft
.sfp
.sfl
✓ ✓ esc SB MB O Apple IIgs font iigs
.fon
✓ ✓ binary see nfnt
Bitmap image [P] image
.png
.gif
.bmp
✓ ✓ image - Set of Bitmap images [P] imageset
.png
.gif
.bmp
✓ ✓ image - LISA font library lisa
.bin
✓ binary M; see nfnt
MacOS font mac
.dfont
.suit
✓ ✓ binary M K; see nfnt
MouseGraphics Toolkit mgtk
✓ binary - mkwinfont text format mkwinfont
.fd
✓ ✓ visual SB Windows or OS/2 font mzfon
.fon
.exe
.dll
✓ (1) binary M; see win
, gpi
Bare NFNT resource nfnt
.f
✓ ✓ binary SB O G (C) Palm OS font (v1/NFNT) palm
.pdb
✓ binary M; see nfnt
Palm OS PRC (v1/NFNT) palm-prc
.prc
✓ binary M; see nfnt
X11 Portable Compiled Format pcf
.pcf
✓ ✓ binary U SB MB O PC/GEOS v2.0+ pcgeos
.fnt
✓ ✓ binary O (MB K) PILfont [P] pilfont
.pil
+ .pbm
✓ ✓ image O TeX PKFONT pkfont
.pk
✓ binary O Adobe Prebuilt Format prebuilt
.bepf
.lepf
✓ binary G (V) Xerox Alto PrePress prepress
.ac
✓ binary O The Print Shop printshop
.pnf
✓ binary - RISCOS x90y45 format riscos-xy
✓ binary O G RISCOS new format riscos
✓ binary O G Signum! 2 signum
.e24
.p9
.p24
.l30
✓ binary - SFont sfont
✓ ✓ image G C SFNT embedded bitmap sfnt
.otb
.ttf
.otf
[F] [**] ✓ (2) binary M US SB MB O K V G (C) SFNT collection ttcf
.otc
.ttc
[F] [**] ✓ (2) binary M US SB MB O K V G (C) vfont vfont
✓ ✓ binary O Bare GEOS font record vlir
✓ ✓ binary O Windows FNT resource win
.fnt
✓ ✓ binary SB monobit yaff yaff
.yaff
✓ ✓ visual M US SB MB O K V G C
[P] requires PIL
[F] requires fontTools
(1) 16-bit Windows NE container with FNT resource only
(2) Bitmap only (OTB)
(3) Limited read functionality: no support for ASCII-art, which is a core feature of Figlet
M multiple-font container
U Unicode
US Unicode, multi-codepoint sequences
SB Single-byte character sets
MB Multi-byte character sets
O Overlapping glyphs K Kerning
V Vertical metrics
G Greyscale fonts
C Colour fonts (not supported by monobit
)
If the abbreviation is bracketed, the format supports this but it is not implemented.
Format Short Name Typical Extension Read Write Type Cell Features 64C64c
.64c
✓ ✓ binary 8x8 - +3DOS plus3dos
✓ ✓ binary 8x8 - BBC soft font bbc
✓ ✓ esc 8x8 - Codepage Information cpi
.cpi
✓ ✓ binary 8xN M SB Dashen dashen
.pft
✓ binary any - DEC DRCS soft font dec
✓ ✓ esc >4xN - Dr. Halo / Dr. Genius drhalo
.fon
✓ binary any - FONTX2 fontx
.fnt
✓ ✓ binary any MB FONTEDIT fontedit
.com
✓ binary 8xN - Fontraption frapt
.com
✓ binary 8xN - Fontraption TSR frapt-tsr
.com
✓ binary 8xN - PCPaint, GRASP old format grasp
.set
.fnt
✓ ✓ binary any - Hanzi Bitmap Font hbf
.hbf
+ raw binary ✓ ✓ binary any SB MB GNU Unifont unifont
.hex
✓ ✓ coded 8x16 (strict) 8xN<=32 (ext) MC U (strict) MC US (ext) Bare codepage kbd
.cp
✓ ✓ binary 8xN SB LETAFONT loader letafont
.com
✓ binary 8x8 - REXXCOM Font Mania mania
.com
✓ binary 8xN - NetBSD wsfont C header netbsd
.h
✓ ✓ coded any M SB Optiks PCR Font pcr
.pcr
✓ ✓ binary 8xN - PC Screen Font psf
.psf
.psfu
✓ ✓ binary any (v2) 8xN (v1) US psf2ams PSFCOM psfcom
.com
✓ binary 8x8, 8x16 - psf2txt psf2txt
.txt
✓ ✓ visual any US Raw binary raw
.fnt
.rom
[*] ✓ ✓ binary - - UDG loader udg
.com
✓ binary 8x8 - FreeBSD console font vtfont
.fnt
✓ ✓ binary any MC U Hercules Write On! writeon
.wof
✓ ✓ binary 8x14 multiples - NetBSD wsfont binary wsfont
.wsf
✓ ✓ binary any SB Wyse-60 soft font wyse
✓ ✓ esc 8x16 - XBIN font section xbin
.xb
✓ ✓ binary 8X<=32 - ZapFont (old format) zapfont
,1bd
✓ ✓ binary any - ZapRedraw UCS zapredraw
,1bd
✓ ✓ binary any U
MC multi-cell glyphs
These formats output a table of glyphs. PDF, text and block charts are write-only, image charts can be read through the image
reader.
chart
✓ Block elements blocks
✓ ANSI colours shades
✓ Image [P] image
✓ ✓ PDF [R] pdf
✓
[P] requires PIL
[R] requires reportlab
Greyscale and colour support is experimental. An extension of the YAFF format allows storing glyphs with up to 8 bits per pixel (256 colours or grey levels).
Stroke font support is experimental. Stroke fonts are scalable fonts defined as line segments. They are fundamentally different from modern fonts in that they define single strokes whereas modern fonts define outlines to be filled with ink. Additionally, the fonts currently supported consist of straight line segments only.
Format Short Name Typical Extension Read Write monobit yaffyaff
.yaff
✓ ✓ SVG Fonts svg
.svg
✓ ✓ Windows resource win
.fnt
✓ ✓ Windows font fon
.fon
✓ ✓ (NE) Borland Graphics Interface borland
.chr
✓ ✓ Hershey fonts (Jim Hurt) hurt
.jhf
✓ DOSStart dosstart
.dsf
✓ GIMMS gimms
.bin
✓
monobit
will recurse and extract font files from a number of common container, archive, compression and encoding formats:
zip
.zip
✓ ✓ GNU tar tar
.tar
.tgz
✓ ✓ RAR [A] rar
.rar
✓ 7-Zip [A] 7zip
.7z
✓ ✓ MS Cabinet [A] cabinet
.cab
✓ LHarc/LHA/LZH [A] lharc
.lha
.lzh
✓ ACE [C] ace
.ace
✓ ISO 9660 [A] iso9660
.iso
✓ ✓ WARC [A] warc
.warc
✓ ✓ CPIO [A] cpio
.cpio
✓ ✓ PAX [A] pax
.pax
✓ ✓ XAR [A] xar
.xar
✓ ✓ AR [A] ar
.ar
✓ ✓ GZip gzip
.gz
✓ ✓ BZip2 bzip2
.bz2
✓ ✓ XZ/LZMA lzma
.xz
.lzma
✓ ✓ Compress [Z] compress
.Z
✓ ✓ AppleSingle apple1
.as
✓ AppleDouble apple2
.adf
.rsrc
✓ MacBinary macbin
.bin
✓ BinHex 4.0 binhex
.hqx
✓ BinSCII binscii
.bsc
.bsq
✓ Intel Hex intel
.ihex
.ihx
✓ ✓ Base64 base64
✓ ✓ Quoted-printable quopri
✓ ✓ UUEncode uuencode
✓ ✓ yEncode [Y] yenc
✓ ✓ MIME multipart email email
.eml
.msg
✓ ✓ C or C++ coded binary c
.c
.cpp
.cc
.h
✓ ✓ JSON coded binary json
.json
✓ ✓ Python coded binary python
.py
✓ ✓ Pascal coded binary pascal
.pas
✓ ✓ BASIC coded binary basic
.bas
✓ ✓
[A] requires libarchive
[C] requires acefile
[Y] requires python3-yenc
[Z] requires ncompress
Note that many of these currently require reading the full archive into memory, which may not be practicable with e.g ISO9660 or WARC files which can hold whole filesystems.
[*] Identifying raw binary filesThis is the most common format used on old platforms, often with the unhelpful suffix .fnt
. As there is no metadata, it's up to you to specify the character-cell size. The most common, and default, size is 8x8 (CGA and many 8-bit platforms), followed by 8x16 (VGA) and 8x14 (EGA).
.f08
, .ch8
, .88
, .chr
, .udg
, and many others..f14
or .814
..f16
, Warp 9 .fnt
or Degas Elite .fnt
.car
files are 16x16 raw files..fnt
files are raw binaries with a 4096x8 pixel bitmap strike hosting 512 8x8 glyphs side by side. Extract with -strike-width=512
.It is also useful to check the file size. Raw files commonly hold 96 (ASCII excluding controls), 128 (ASCII), 256, or multiples thereof. Common file sizes therefore are:
8x8 8x14 8x16 96 768 1344 1536 128 1024 1792 2048 256 2048 3584 4096 512 4096 7168 8192If your unidentified font file has one of these sizes, chances are it is a raw binary file.
[**] TrueType / OpenType embedded bitmapsmonobit
can extract bitmaps embedded in TrueType and OpenType font files. It should be kept in mind that these are primarily intended as scalable formats, and only exceptionally embed bitmaps to improve rendering on low-resolution displays.
The vast majority of .ttf
, .otf
, .dfont
etc. files do not contain bitmaps at all. This is true even for fonts with a pixelised look. To convert these you first need to rasterise them, which monobit
does not do. Some of the other font tools linked below do have rasterising features.
monobit
can experimentally output OpenType Bitmap (.otb
) files, a bitmap-only file format supported by Linux desktops.
Some formats require
Pillow
)The renderer additionally employs
Almost all can be installed through Pip:
pip install Pillow reportlab fonttools uniseg python-bidi arabic-reshaper libarchive-c ncompress acefile
The package python3-yenc
is available at https://github.com/oe-mirrors/python3-yenc and through some Linux distributions. Without these packages, some functionality may not be available.
monobit
and the yaff
specification are copyright 2019--2024 Rob Hagemans and released under the MIT licence.
monobit
contains code from:
mkwinfont
copyright 2001 Simon Tatham. All rights reserved.dewinfont
copyright 2001,2017 Simon Tatham. All rights reserved.Please refer to the notices in the windows
and os2
subpackages and mac/fond.py
module for licences and more information.
The font files in tests/fonts
are subject to their own licences, some of which are more restrictive. These are files used for testing and development and are not included in the packaged distribution. See tests/fonts/README.md
and notices included with individual files.
monobit
would not exist without those documenting, reverse-engineering, implementing and preserving font formats and files:
Other bitmap font tools you could use in conjunction with (or instead of) monobit
include:
gbdfed
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4