Skip to main content

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.

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=hex

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 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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monobit-0.30.1.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

monobit-0.30.1-py3-none-any.whl (2.9 MB view details)

Uploaded Python 3

File details

Details for the file monobit-0.30.1.tar.gz.

File metadata

  • Download URL: monobit-0.30.1.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

Hashes for monobit-0.30.1.tar.gz
Algorithm Hash digest
SHA256 474cee2ff9c9f44e1e3093825a94fdcae7d9db9b9bd34ed6f7e33de8dc996e19
MD5 5cd574822f36ac237f9c65559645324d
BLAKE2b-256 e211b904658462ca32fc683f7c87024670e77961c695f1343879a18bfadc26fe

See more details on using hashes here.

File details

Details for the file monobit-0.30.1-py3-none-any.whl.

File metadata

  • Download URL: monobit-0.30.1-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

Hashes for monobit-0.30.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35047e679f40a9cbdadab62e99b09447c97c95d42873e461db4543ed26a91fa4
MD5 66d794872bd2bdb2e0c47d59979bc069
BLAKE2b-256 43b19504a4881d79c1ffd72833cb8c7c28c30e8a4512cf7e81654fe9717a9d69

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page