Tools for working with monochrome bitmap fonts.
Project description
-@@------------------------------------------@@------@@--------------@@-
-@@------------------------------------------@@------@@--@@----------@@-
-@@------------------------------------------@@----------@@----------@@-
-@@------@@@@@@@@@----@@@@---@@@@@----@@@@---@@@@@---@@-@@@@---------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@----------@@-
-@@------@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@--@@------@@-
-@@------@@--@@--@@---@@@@---@@--@@---@@@@---@@@@@---@@---@@-@@------@@-
-@@------------------------------------------------------------------@@-
-@@------------------------------------------------------------------@@-
-@@------------------------------------------------------------------@@-
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.
Usage examples
Convert utility
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.
Banner utility
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.
Supported bitmap formats
Format | Short Name | Typical Extension | Read | Write |
---|---|---|---|---|
64C | 64c |
.64c |
✓ | ✓ |
+3DOS | plus3dos |
✓ | ✓ | |
Xerox Alto CONVERT | alto |
.al |
✓ | |
Amiga Font Contents | amiga-fc |
.font |
✓ | |
Amiga font | amiga |
✓ | ||
BBC soft font | bbc |
✓ | ✓ | |
X11/Adobe BDF | bdf |
.bdf |
✓ | ✓ |
Xerox Alto BITBLT | bitblt |
.strike .ks |
✓ | |
AngelCode BMFont [P] | bmfont |
.fnt .xml .json + images |
✓ | ✓ |
Consoleet / vfontas | consoleet |
.txt |
✓ | |
Codepage Information | cpi |
.cpi |
✓ | ✓ |
Daisy-Dot | daisy |
.nlq .nl2 .nl3 .nl4 |
✓ | |
Dashen | dashen |
.pft |
✓ | |
DEC DRCS soft font | dec |
✓ | ✓ | |
DosStart! | dosstart |
.dsf |
✓ | |
Dr. Halo / Dr. Genius | drhalo |
.fon |
✓ | |
EDWIN bitmap font | edwin |
.fnt |
✓ | ✓ |
Figlet font | figlet |
.flf |
✓ | ✓ |
FZX font | fzx |
.fzx |
✓ | ✓ |
FONTX2 | fontx |
.fnt |
✓ | ✓ |
FONTEDIT | fontedit |
.com |
✓ | |
Fontraption | frapt |
.com |
✓ | |
Fontraption TSR | frapt-tsr |
.com |
✓ | |
Hanzi Bitmap Font | hbf |
.hbf + raw binary |
✓ | ✓ |
OS/2 GPI resource | gpi |
.fnt |
✓ | |
Atari GDOS / GEM | gdos |
.fnt .gft .vga |
✓ | ✓ |
C64 GEOS ConVerT | geos |
.cvt |
✓ | |
HP PCL soft font | hppcl |
.sft .sfp .sfl |
✓ | ✓ |
GNU Unifont | unifont |
.hex |
✓ | ✓ |
Extended Hex | pcbasic |
.hex |
✓ | ✓ |
hexdraw | hexdraw |
.draw |
✓ | ✓ |
Bitmap image [P] | image |
.png .gif .bmp |
✓ | ✓ |
Set of Bitmap images [P] | imageset |
.png .gif .bmp |
✓ | ✓ |
Apple IIgs font | iigs |
.fon |
✓ | ✓ |
Bare codepage | kbd |
.cp |
✓ | ✓ |
LETAFONT loader | letafont |
.com |
✓ | |
LISA font library | lisa |
.bin |
✓ | |
REXXCOM Font Mania | mania |
.com |
✓ | |
MacOS font | mac |
.dfont .suit |
✓ | ✓ |
mkwinfon text format | mkwinfon |
.fd |
✓ | |
Bare NFNT resource | nfnt |
.f |
✓ | ✓ |
Windows or OS/2 font | mzfon |
.fon .exe .dll |
✓ | ✓ (16-bit Windows) |
Palm OS font (v1/NFNT) | palm |
.pdb |
✓ | |
X11 Portable Compiled Format | pcf |
.pcf |
✓ | ✓ |
PCPaint, GRASP, ChiWriter | pcpaint |
.set .fnt .sft .pft .eft ... |
✓ | |
Optiks PCR Font | pcr |
.pcr |
✓ | |
PDF chart [R] | pdf |
.pdf |
✓ | |
PILfont [P] \ pilfont |
.pil + .pbm |
✓ | ✓ | |
TeX PKFONT | pkfont |
.pk |
✓ | |
Adobe Prebuilt Format | prebuilt |
.bepf .lepf |
✓ | |
Xerox Alto PrePress | prepress |
.ac |
✓ | |
The Print Shop | printshop |
.pnf |
✓ | |
PC Screen Font | psf |
.psf .psfu |
✓ | ✓ (version 2) |
PSF2AMS PSFCOM | psfcom |
.com |
✓ | |
PSF2TXT | psf2txt |
.txt |
✓ | |
Raw binary | raw |
.fnt .rom [*] |
✓ | ✓ |
Signum! 2 | signum |
.e24 .p9 .p24 .l30 |
✓ | |
SFont | sfont |
✓ | ✓ | |
SFNT embedded bitmap | sfnt |
.otb .ttf .otf [F] [**] |
✓ | ✓ (OTB) |
SFNT collection | ttcf |
.otc .ttc [F] [**] |
✓ | ✓ (OTB) |
UDG loader | udg |
.com |
✓ | |
vfont | vfont |
✓ | ✓ | |
Bare GEOS resource | vlir |
✓ | ||
Windows FNT resource | win |
.fnt |
✓ | ✓ |
Hercules Write On! | writeon |
.wof |
✓ | ✓ |
Wyse-60 soft font | wyse |
✓ | ||
XBIN font section | xbin |
.xb |
✓ | ✓ |
monobit yaff | yaff |
.yaff |
✓ | ✓ |
[P] - requires PIL
[R] - requires reportlab
[F] - requires fontTools
[*] Identifying raw binary files
This 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).
- 8x8 raw files are also known as
.f08
,.ch8
,.88
,.chr
,.udg
, and many others. - 8x14 raw files are also known as
.f14
or.814
. - 8x16 raw files are also known as
.f16
, Warp 9.fnt
or Degas Elite.fnt
- Genecar
.car
files are 16x16 raw files. - Harlekin III
.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 | 8192 |
If your unidentified font file has one of these sizes, chances are it is a raw binary file.
[**] TrueType / OpenType embedded bitmaps
monobit
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.
Font format features
Here is a comparison of what you can and cannot store in selected formats supported by monobit
.
Format | Unicode | Unicode sequences | Encoding | MBCS | Multiple fonts | Cell size | Proportional | Kerning | Colour/antialiasing | Glyph representation |
---|---|---|---|---|---|---|---|---|---|---|
yaff |
✓ | ✓ | ✓ | ✓ | ✓ | any | ✓ | ✓ | visual text | |
sfnt |
✓ | ✓ | ✓ | ✓ | ✓ | any | ✓ | ✓ | ✓ | binary |
bmfont |
✓ | ✓ | ✓ | any | ✓ | ✓ | ✓ | image | ||
mac |
✓ | any | ✓ | ✓ | ✓ | binary | ||||
bdf |
✓ | ✓ | ✓ | any | ✓ | hex | ||||
win |
✓ | ✓ | any | ✓ | binary | |||||
hexdraw |
✓ | any | ✓ | visual text | ||||||
amiga |
✓ | any | ✓ | ✓ | binary | |||||
gdos |
any | ✓ | binary | |||||||
fzx |
any | ✓ | binary | |||||||
figlet |
✓ | any | ✓ | ✓ | visual text | |||||
vfont |
any | ✓ | binary | |||||||
pcbasic |
✓ | ✓ | 8xN | multi-cell | hex | |||||
unifont |
✓ | 8x16 | multi-cell | hex | ||||||
hbf |
✓ | ✓ | any | binary | ||||||
psf (v2) |
✓ | ✓ | any | binary | ||||||
psf (v1) |
✓ | 8xN | binary | |||||||
fontx |
✓ | any | binary | |||||||
cpi |
✓ | ✓ | 8xN | binary | ||||||
dec |
>4xN | binary | ||||||||
bbc |
8x8 | binary |
Wrapper formats
monobit
will recurse and extract font files from a number of common container,
archive, compression and encoding formats:
Format | Name | Typical Extension | Read | Write |
---|---|---|---|---|
PKZip/WinZip | 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.
Stroke formats
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 yaff | yaff |
.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 |
✓ |
Dependencies
Some formats require
- PIL (
Pillow
) - reportlab
- fontTools
- libarchive
- python3-yenc
- ncompress
- acefile
The renderer additionally employs
- uniseg
- python-bidi
- arabic-reshaper
All can be installed through Pip:
pip install Pillow reportlab fonttools uniseg python-bidi arabic-reshaper libarchive-c python3-yenc ncompress acefile
Without these packages, some functionality may not be available.
Copyright and licences
monobit
and the yaff
specification are copyright 2019--2023 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.- OS/2 GPI Font Tools (C) 2012 Alexander Taylor
- FONDU copyright (C) 2000,2001,2002,2003 by George Williams
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.
Acknowledgements
monobit
would not exist without those documenting,
reverse-engineering, implementing and preserving font formats and files:
- The Internet Archive
- Archive Team
- Jason Scott's textfiles.com
- John Elliott's homepage
- Simon Tatham's fonts page
- Aivosto's character set documentation
- Rebecca Bettencourt's character set documentation
- Xiphoseer's Signum Document Toolbox
- George Williams et al.'s FontForge documentation
- FreeType Glyph Conventions
- ... and many others
Other software
Other bitmap font tools you could use in conjunction with (or instead of) monobit
include:
- FontForge
- Rebecca Bettencourt's Bits'n'Picas
- John Elliott's PSFTools
- Mark Leisher's
gbdfed
- RECOIL
- John Zaitseff's console font utilities
- George Williams's Fondu
- VileR's Fontraption
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file monobit-0.44.0.tar.gz
.
File metadata
- Download URL: monobit-0.44.0.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81d39234a00d9eb646ec66f45d5011806329aa0b021c8142a1ac56e33db5b288 |
|
MD5 | 9c1ef1ef63640db8391f0d257b37dd9a |
|
BLAKE2b-256 | 237a0d32bc96345115c2b5101300e86fb30aab2fcb7b5e918361cbcaff3fc5f5 |
File details
Details for the file monobit-0.44.0-py3-none-any.whl
.
File metadata
- Download URL: monobit-0.44.0-py3-none-any.whl
- Upload date:
- Size: 3.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29302a0f66eac77bcef28c770006c04218693e022945ab5afb06731419b505ad |
|
MD5 | 11cb808c1c8953d48e7492769b48594c |
|
BLAKE2b-256 | 9804cbd7c8957ed77f63c59b4e205cfe321458b819ddcab1046d62c83ed8800e |