txt2psf - compile a PC Screen Font file from a textual description
txt2psf [--psf1] [--psf2] [INPUTFILE
[OUTPUTFILE]]
txt2psf converts an ASCII source file to a font in the .PSF format.
The source file is composed of a header, followed by a series of character
definitions. The first line of the header must be "%PSF2"; it is
followed by these fields, each on a separate line, in any order:
- Version: nnn
- File format version; currently this must be 0.
- Flags: nnn
- This is 1 if the font should include a Unicode table, else 0.
- Length: nnn
- The number of characters in this font. If it is too low, the extra
characters will be ignored. Too high, and the extras will be left
blank.
- Width: nnn
- The width of a character cell.
- Height: nnn
- The height of a character cell.
After the header, character definitions follow. Each character
definition starts as a "%" on a line by itself. It is then
followed by two fields, in any order.
- Bitmap: bitmapdata
- The bitmap is composed of width*height cells, each of which is either a
'-' (zero) or a '#' (black). Whitespace is ignored. The bitmap can be
spread over several lines; the bitmaps created by psf2txt(1) are, for
example.
- Unicode: unicodestring
- This describes the Unicode characters this bitmap represents. It is formed
"[single];[sing]e];...[sequence];[sequence];..." where
single is a single hexadecimal number, and sequence is two
or more hexadecimal numbers separated by + signs. So "[41];" is
an example of a single character, and "[00B4+0065];" is an
example of a sequence. If the bitmap doesn't represent any Unicode
characters this field may be blank or simply missing.
- --psf1
- Force the resulting file to be in PSF1 format.
- --psf2
- Force the resulting file to be in PSF2 format.
The file format is too rigid, and the parser (such as it is) a quick hack.
The "Length:" header should not be necessary; txt2psf
should be able to calculate the file size itself.
John Elliott <seasip.webmaster@gmail.com>.