UNIFONT(5) | File Formats Manual | UNIFONT(5) |
Unifont - a bitmapped font with full Unicode Plane 0 (BMP) coverage
unifont.hex
Unifont is a bitmapped font with glyphs described in a plain text file, generically referred to as unifont.hex herein. This man page describes the format of three related files: unifont.hex, masks.hex, and combining.txt. All three of these files start with a Unicode code point as a hexadecimal string, with code points appearing in ascending order.
A unifont.hex file consists of single-line entries for each Unicode code point. Each line contains the code point, a colon (':') field separator, and the glyph bitmap. The glyphs in a unifont.hex format file must appear in ascending Unicode code point order.
This file can be converted into a BDF font using the hex2bdf(1) program, and into a TrueType font using fontforge(1) (which is not part of this package). The BDF font can also be converted into a PCF font using bdftopcf(1) (which is also not part of this package).
The first field
The second field
As each hexadecimal digit can encode four bits, one pixel row of a glyph is either two hexadecimal digits long (single-width) or four hexadecimal digits long (double-width). The glyphs are 16 pixels tall, so a single-width glyph is (2)(16) = 32 hexadecimal digits long and a double-width glyph is (4)(16) = 64 hexadecimal digits long.
Previous versions of this package supplied a file named masks.hex. This file followed the same format as unifont.hex with a first field that was a Unicode code point in hexadecimal, followed by a colon (':') field separator, followed by a second field that was a hexadecimal string representing a glyph bitmap. Code points were in ascending order. The glyph bitmaps were bitmaps that would be exclusive-ored with the glyph in unifont.hex that had the same code point. The original unifont.hex contained combining circles as depicted in The Unicode Standard. When Paul Hardy got combining characters to display properly in the TrueType version, it became desirable to remove these combining circles for proper display with unifont.ttf. The program uniunmask(1) will read such a masks.hex file, read a unifont.hex format file, and apply the exclusive-or masks in masks.hex to unifont.hex. The output is another file in unifont.hex format with the masked-off bits (i.e., combining circles) removed.
Because the operation is an exclusive-or, masks.hex could also be used to turn on pixels in selective glyphs, for example to add combining circles to selective glyphs that do not show them. However, the program unigencircles(1) can do this without a separate masks.hex file. Thus masks.hex is no longer supplied with this package. uniunmask(1) remains part of this distribution in case someone might find creating a custom masks.hex file useful for another purpose.
The TrueType version of the font, unifont.ttf, and the unigencircles(1) utility both read a file combining.txt. This file appears in the directory font/ttfsrc. The combining.txt file is a list of code points as hexadecimal strings, one per line in ascending order, of Unicode code points that show combining circles in The Unicode Standard. Any glyph with its code point listed in combining.txt will have zero width in unifont.ttf.
Roman Czyborra, the font's creator, originally wrote two Perl scripts as utilities: bdfimplode(1) and hexdraw(1).
The bdfimplode(1) Perl script reads in a font in BDF format and generates a font output in unifont.hex format.
The hexdraw(1) Perl script might appear somewhat magical. It can read a file in unifont.hex format and generate a text file with each glyph appearing as a grid of characters in an 8 by 16 or 16 by 16 grid: a '-' character indicates a corresponding white pixel, and a '#' character indicates a corresponding black pixel. These pixel grids are indented with a single tab character. The first line of each glyph first shows the code point for the glyph, followed by a colon (':'). The 16 lines that graphically represent each glyph are followed by one blank line. This text file can then be modified with any text editor. The magical part about hexdraw(1) is that it will read in this text file, detect that it is in this converted format, and produce as output a second file in Unifont's .hex format. Thus hexdraw(1) automagically provides round-trip coverage between an original font file in unifont.hex format and an intermediate text graphics format for editing.
Utilities introduced after those first two convert a file in unifont.hex format to and from bitmapped graphics (".bmp") files. The unihex2bmp(1) program converts a file in unifont.hex format into a .bmp format file, for editing with a graphics editor. The unibmp2hex(1) program performs the reverse conversion, from a bitmapped graphics format back to a file in unifont.hex format.
hexdraw(1), unihex2bmp(1), and unibmp2hex(1) are the central programs that handle conversion of a unifont.hex file to and from two-dimensional glyph representations for visual editing. See the doc/unifont.info texinfo file included in the source package for more information on these and other utilities to customize unifont.hex format files. Also consult the man pages for the utilities listed below.
The following files are part of the Unifont source distribution:
bdfimplode(1), hex2bdf(1), hex2otf(1), hex2sfd(1), hexbraille(1), hexdraw(1), hexkinya(1), hexmerge(1), johab2ucs2(1), unibdf2hex(1), unibmp2hex(1), unibmpbump(1), unicoverage(1), unidup(1), unifont-viewer(1), unifont1per(1), unifontchojung(1), unifontksx(1), unifontpic(1), unigencircles(1), unigenwidth(1), unihex2bmp(1), unihex2png(1), unihexfill(1), unihexgen(1), unihexrotate(1), unipagecount(1), unipng2hex(1)
The unifont.hex format was created by Roman Czyborra, who drew the original set of glyphs.
unifont is Copyright © 1998 Roman Czyborra, with portions Copyright © 2007–2013 Paul Hardy, Copyright © 2004–2013 Qianqian Fang, and others.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
The format is very straightforward and no real bugs exist. However, Unifont's original BDF font format does not support Unicode's combining characters (accents, etc.); only the TrueType version of Unifont does.
2020 Jul 03 |