Commandline tool to generate images from charsets and texts.
While pixeling a font (also known as charset) for a demoscene production, it would be nice to know how it will look, using the final text.
It's very common, that some letters looking good in the font itself, but not when used in a real text, consisting of different words and phrases.
To check, if the letters of the font work nicely together, you can cut'n'paste them one by one to form a complete textpage, which can take hours. Or you can use a tool to do the same job in a few seconds: Chartist
Chartist reads your graphicsfile with the letters (the font/charset), your textfile with all those words/phrases and will output a new graphics file, showing your text by using your pixeled letters, simple as that.
Pixeled fonts are often used in demos for Retrocomputers like Amiga, Atari ST, Commodore 64, etc.
From Wikipedia:
The demoscene is a computer art subculture that specializes in producing demos, which are audio-visual presentations that run in real-time on a computer. The main goal of a demo is to show off programming, artistic, and musical skills.
Those fonts are often starting with the SPACE-Symbol (Pos. 32) and ending with the Z-Letter (Pos. 90) of the ASCII-Table. If your font is not ordered this ascii-relative way, you can simply create a mapping table with the correct order. Chartist supports fonts with chars from Pos. 32 (Space) up to Pos. 126 (Tilde-Symbol), so that all upper- and lowercase letters, numbers and symbols can be used.
Most of those fonts have a fixed size, e.g. 8 by 8 pixels, 16 by 16 pixels and so on. But some symbols like the . (dot) or the , (comma) look a bit lost when placed in such a grid. To avoid this, you can create a width table to define letters or symbols with a smaller width.
The background color is simply auto-detected by looking which color is used by the majority of the pixels in the font-image. But you can set it manually, if the wrong color is choosen.
The amount of colors for the font is not limited. You can have indexed colors aswell as true color,
if the are supported by the image format, for example PNG.
The size of the letters is auto-detected by the height (y-axis) of the font-image. If it does not work, you can also set this value manually, expecially when the letters are arranged in multiple lines instead of one, single line.
- Python (3.5, 3.6, 3.7, 3.8, 3.9) - https://www.python.org/
- Pillow (Python Imaging Library) - https://pypi.org/project/Pillow/
If missing, Pillow can be installed using pip.
Linux:
$ pip install pillow
Windows:
$ python -m pip install pillow
Chartist is easy to use and really straightforward to generate a fontpage.
Just run chartist
using the provided font and the test text:
$ chartist.py font-oneliner-asciirelative.png testtext.txt
The generated image should be displayed by the default imageviewer of the operating system.
Write the generated image to disk:
$ chartist.py font-oneliner-asciirelative.png testtext.txt -o fontpage.gif
The submited filetype ".gif" sets the format of the output file.
Force resolution of generated image:
$ chartist.py font-oneliner-asciirelative.png testtext.txt -r 320 256
Otherwise the resolution is calculated by the size of the chars and the amount of text.
Render a non ascii-relative font by using a mapping table:
$ chartist.py font-oneliner-nonasciirelative.png testtext.txt -m font-mappingtable.txt
Because the order of the font is assumed as ascii-relative by default.
You can also use fonts which are spread over multiple lines: