Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
FONT(7) FreeBSD Miscellaneous Information Manual FONT(7)

font, subfont - external format for fonts and subfonts

#include <draw.h>

Fonts and subfonts are described in

External bitmap fonts are described by a plain text file that can be read using openfont. The format of the file is a header followed by any number of subfont range specifications. The header contains two numbers: the height and the ascent, both in pixels. The height is the inter-line spacing and the ascent is the distance from the top of the line to the baseline. These numbers are chosen to display consistently all the subfonts of the font. A subfont range specification contains two or three numbers and a file name. The numbers are the inclusive range of characters covered by the subfont, with an optional starting position within the subfont, and the file name names an external file suitable for readsubfont (see The minimum number of a covered range is mapped to the specified starting position (default zero) of the corresponding subfont. If the subfont file name does not begin with a slash, it is taken relative to the directory containing the font file. Each field must be followed by some white space. Each numeric field may be C-format decimal, octal, or hexadecimal.

External subfonts are represented in a more rigid format that can be read and written using readsubfont and writesubfont (see The format for subfont files is: an image containing character glyphs, followed by a subfont header, followed by character information. The image has the format for external image files described in The subfont header has 3 decimal strings: n, height, and ascent. Each number is right-justified and blank padded in 11 characters, followed by a blank. The character info consists of n+1 6-byte entries, each giving the Fontchar x (2 bytes, low order byte first), top, bottom, left, and width. The x field of the last Fontchar is used to calculate the image width of the previous character; the other fields in the last Fontchar are irrelevant.

Note that the convention of using the character with value zero (NUL) to represent characters of zero width (see means that fonts should have, as their zeroth character, one with non-zero width.

Font names in Plan 9 from User Space are a small language describing a font. The most basic form is the name of an existing bitmap font file, following the convention:

where size is approximately the height in pixels of the lower case letters (without ascenders or descenders). Range gives some indication of which characters will be available: for example ascii, latin1, euro, or unicode. Euro includes most European languages, punctuation marks, the International Phonetic Alphabet, etc., but no Oriental languages. Unicode includes every character for which appropriate-sized images exist on the system.

In Plan 9 from User Space, the font files are rooted in $PLAN9/font instead of /lib/font/bit, but to keep old references working, paths beginning with /lib/font/bit are interpreted as references to the actual font directory.

Fonts need not be stored on disk in the Plan 9 format. If the font name has the form /mnt/font/name/size/font, fontsrv is invoked to synthesize a bitmap font from the operating system's installed vector fonts. The command fontsrv -p . lists the available fonts. See for more.

If the font name has the form scale*fontname, where scale is a small decimal integer, the fontname is loaded and then scaled by pixel repetition.

The Plan 9 bitmap fonts were designed for screens with pixel density around 100 DPI. When used on screens with pixel density above 200 DPI, the bitmap fonts are automatically pixel doubled. Similarly, fonts loaded from are automatically doubled in size by varying the effective size path element. In both cases, the effect is that a single font name can be used on both low- and high-density displays (or even in a window moved between differing displays) while keeping roughly the same effective size.

For more control over the fonts used on low- and high-density displays, if the font name has the form lowfont,highfont, lowfont is used on low-density displays and highfont on high-density displays. In effect, the behavior described above is that the font name


really means


and similarly


really means


Using an explicit comma-separated font pair allows finer control, such as using a Plan 9 bitmap font on low-density displays but switching to a system-installed vector font on high-density displays:


font directories

Search for    or go to Top of page |  Section 7 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.