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 first field is the Unicode code point in hexadecimal, ranging from "0000" through "FFFF", inclusive. This corresponds to the Unicode code points U+0000 through U+FFFF, respectively.

The second field

The second field is the glyph's bitmap string. This is a series of hexadecimal digits. Currently Unifont encodes two glyph sizes: 8 pixels wide by 16 pixels tall (single-width), and 16 pixels wide by 16 pixels tall (double-width).

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 exmaple 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. The first line shows the code point for a glyph, followed by a colon (':'). 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 TUTORIAL file included in the source pakcage 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:


GNU Unifont font files


The Unifont license


Instructions on building Unifont


Tutorial on customizing Unifont

RELATED TO unifont…


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 straihtforward 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.