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.
A a working Python 3 installation is required and some formats or features require additional packages to be installed; see Dependencies below.
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.
python3 convert.py -h
Display usage summary and command-line options
python3 convert.py --format=raw -h
Display usage summary and additional format-specific command-line options for conversion from raw binary.
python3 convert.py 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.
python3 convert.py roman.bdf to --format=hex
Read font from BDF file and write to standard output as Unifont HEX.
python3 convert.py fixed.psf to fixed.png
Read font in PSF format and write to disk as image in PNG format.
python3 convert.py --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
python3 convert.py --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:~$ python3 banner.py '| monobit. |' --font=VGASYS.FON
banner.py
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 python3 banner.py --help
for usage.
Supported formats
Format | Short Name | Version | Typical Extension | Native OS | Read | Write |
---|---|---|---|---|---|---|
monobit yaff | yaff |
.yaff |
✔ | ✔ | ||
hexdraw | hexdraw |
.draw |
✔ | ✔ | ||
GNU Unifont | hex |
.hex |
✔ | ✔ | ||
PC Screen Font | psf |
1 | .psf |
MS-DOS | ✔ | |
PC Screen Font | psf |
2 | .psf .psfu |
Linux | ✔ | ✔ |
Raw binary | binary |
.fnt .rom .f?? .ch8 .64c .chr |
✔ | ✔ | ||
Bitmap image | image |
.png .gif .bmp |
✔ (P) | ✔ (P) | ||
PDF chart | pdf |
.pdf |
✔ (R) | |||
C or C++ coded binary | c |
.c .cpp .cc .h |
✔ | ✔ | ||
JSON coded binary | json |
.json |
✔ | ✔ | ||
Python coded binary | python |
.py |
✔ | ✔ | ||
AngelCode BMFont | bmfont |
Text | .fnt + images |
✔ (P) | ✔ (P) | |
AngelCode BMFont | bmfont |
Binary | .fnt + images |
✔ (P) | ||
AngelCode BMFont | bmfont |
XML | .fnt .xml + images |
✔ (P) | ||
AngelCode BMFont | bmfont |
JSON | .json + images |
✔ (P) | ✔ (P) | |
X11/Adobe BDF | bdf |
.bdf |
Unix | ✔ | ✔ | |
Codepage Information | cpi |
FONT | .cpi |
MS-DOS | ✔ | |
Codepage Information | cpi |
FONT.NT | .cpi |
Windows NT | ✔ | |
Codepage Information | cpi |
DRFONT | .cpi |
DR-DOS | ✔ | |
kbd Codepage |
kbd-cp |
.cp |
Linux | ✔ | ||
DEC DRCS | dec-drcs |
DEC VT | ✔ | ✔ | ||
Amiga Font Contents | amiga-fc |
.font |
Amiga OS | ✔ | ||
Amiga Font | amiga |
Amiga OS | ✔ | |||
FZX Font | fzx |
.fzx |
ZX Spectrum | ✔ | ✔ | |
Figlet | figlet |
.flf |
Unix | ✔ | ✔ | |
MacOS font | mac-dfont |
FONT | .dfont .suit |
MacOS | ✔ | |
MacOS font | mac-dfont |
NFNT/FOND | .dfont .suit |
MacOS | ✔ | |
MacOS font (AS/AD) | mac-rsrc |
FONT | .rsrc |
MacOS | ✔ | |
MacOS font (AS/AD) | mac-rsrc |
NFNT/FOND | .rsrc |
MacOS | ✔ | |
Windows resource | win-fnt |
1.0 | .fnt |
Windows 1.x | ✔ | |
Windows resource | win-fnt |
2.0 | .fnt |
Windows 2.x | ✔ | ✔ |
Windows resource | win-fnt |
3.0 | .fnt |
Windows 3.x | ✔ | ✔ |
Windows font | win-fon |
1.0 NE | .fon |
Windows 1.x | ✔ | |
Windows font | win-fon |
2.0 NE | .fon |
Windows 2.x | ✔ | ✔ |
Windows font | win-fon |
3.0 NE | .fon |
Windows 3.x | ✔ | ✔ |
Windows font | win-fon |
2.0 PE | .fon |
Windows 2.x | ✔ | |
Windows font | win-fon |
3.0 PE | .fon |
Windows 3.x | ✔ |
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 | |
bmfont |
✔ | ✔ | ✔ | any | ✔ | ✔ | ✔ | image | ||
bdf |
✔ | ✔ | ✔ | any | ✔ | hex | ||||
mac-* |
✔ | ✔ | ✔ | any | ✔ | ✔ | ✔ | binary | ||
win-* |
✔ | ✔ | ✔ | any | ✔ | binary | ||||
hexdraw |
✔ | any | ✔ | visual text | ||||||
amiga-* |
✔ | any | ✔ | ✔ | binary | |||||
fzx |
any | ✔ | binary | |||||||
figlet |
✔ | any | ✔ | ✔ | visual text | |||||
dec-drcs |
>4xN | binary | ||||||||
hext |
✔ | ✔ | 8xN | multi-cell | hex | |||||
hex |
✔ | 8x16 | multi-cell | hex | ||||||
psf.2 |
✔ | ✔ | any | binary | ||||||
psf.1 |
✔ | 8xN | binary | |||||||
cpi |
✔ | ✔ | 8xN | binary |
Dependencies
(P) - requires PIL, install with pip3 install Pillow
.
(R) - requires reportlab, install with pip3 install reportlab
.
Licence
monobit
and the yaff
specification are released under the
Expat MIT licence.
Acknowledgements
monobit
contains code from Simon Tatham's mkwinfont
and dewinfont
.
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
- Simon Tatham's
mkwinfont
/dewinfont
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.30.0.tar.gz
.
File metadata
- Download URL: monobit-0.30.0.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51ba25746a60606bd792363b423ffe0f0cc46e8e3c7e774d8e06d1a849e0761e |
|
MD5 | 0e6d4a6a37eb5fbb8e1e18d6af26c265 |
|
BLAKE2b-256 | f4eab64c9ef01fac7e29b079c434750b571d13fd47325ae9c8672638be8f4a4a |
File details
Details for the file monobit-0.30.0-py3-none-any.whl
.
File metadata
- Download URL: monobit-0.30.0-py3-none-any.whl
- Upload date:
- Size: 2.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceec14cf46f274eb71aea3119391e39b3eea18e3b8d6c3ad1825d7bfac613320 |
|
MD5 | af1828faa9a6636b5a5b74243e41f84c |
|
BLAKE2b-256 | 590ee463f2d13c0fbf939d7c6cb6039c9a310d1e13b25251872a6cbc356182c7 |