[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    loadfont(4) manual page Table of Contents

Name

loadfont - format of a font file used as input to the loadfont utility

Availability

x86

Description

This section describes the format of files that can be used to change the font used by the console when using the loadfont(1) utility with the -f option.

The format is compatible with the Binary Distribution Format version 2.1 as developed by Adobe Systems, Inc.; however, certain restrictions apply. Video cards, when used with the Solaris for x86 system in text mode, only accept constant width and constant height fonts in certain sizes.

The loadfont utility also requires that there is a description of all 256 characters of the codeset used specified in the fontfile. Certain attributes are not used by loadfont but are maintained for compatibility purposes.

File Format

A loadfont input file is a plain ASCII file containing only printable characters (octal 40 through 176) and a carriage return at the end of each line.

The information about a particular font should be contained in a single file. The file begins with information on the font in general, followed by the information and bitmaps for the individual characters. The file should contain bitmaps for all 256 characters, and each character should be of the same size.

A font bitmap description file has the following general form, where each item is contained on a separate line of text in the file. Items on a line are separated by spaces:

One or more lines beginning with the word COMMENT . These lines can be used to add comments to the file and will be ignored by the loadfont program.

The word STARTFONT followed by the version number 2.1.

The word FONT followed by the full name of the font. The name may continue all the way to the end of the line, and may contain spaces.

The word SIZE followed by the point size of the characters, the x resolution, and the y resolution of the font. This line is not used by loadfont but it needs to be there for compatibility purposes.

The word FONTBOUNDINGBOX followed by the width in x, height in y, and the x and y displacement of the lower left-hand corner from the origin. Again, this line is not used by loadfont but it must be there for compatibility purposes.

Optionally, the word STARTPROPERTIES followed by the number of properties that follow. If present, the number needs to match the number of lines following this one before the occurrence of a line beginning with ENDPROPERTIES These lines consist of a word for the property name followed by either an integer or string surrounded by double quotes. Properties named FONT_ASCENT FONT_DESCENT and DEFAULT_CHAR are typically present in BDF files to define the logical font-ascent and font-descent and the default-char for the font.

As mentioned above, this section, if it exists, must be terminated by ENDPROPERTIES .

The word CHARS followed by the number of characters that follow. This number should always be 256.

This terminates the part of the loadfont input file describing features of the font in general. The rest of the file contains descriptions of the individual characters. They consist of the following parts:

The word STARTCHAR followed by up to 14 characters (no blanks) describing the character. This can either be something like C0041, which indicates the hex value of the character or uppercaseA, which describes the character.

The word ENCODING followed by a positive integer representing value by which this character is represented internally in the codeset for which this font is used. The integer needs to be specified in decimal.

The word SWIDTH followed by the scalable width in x and y of character. Scalable widths are in units of 1/1000th of the size of the character. The y value should always be 0; the x value is typically 666 for the type of characters used with loadfont. The values are not checked by the loadfont utility, but this line needs to be there for compatibility purposes.

The word DWIDTH followed by two numbers, which in a BDF file would mean the width in x and y of the character in device units. The y value is always zero. The x value is typically 8. loadfont checks only for the presence of the DWIDTH keyword.

The word BBX followed by the width in x, height in y and x and y displacement of the lower left-hand corner from the origin of the character.

Most fonts used by video cards will not use the bottom 4 rows of pixels, which basically means a vertical (y) displacement of -4. The only width allowed by loadfont is 8; heights supported are 8, 14, and 16. All BBX lines of the subsequent characters should list the same height and width as the first one (because only fixed size fonts are supported).

The optional word ATTRIBUTES followed by the attributes as 4 hex-encoded characters. The loadfont utility will accept this line, if present, but there is no meaning attached to it.

The word BITMAP , which indicates the beginning of the bitmap representation of the character. This line should be followed by height number of lines (height as specified in the BBX line) representing a hex-encoded bitmap of the character, one byte per line.

The word ENDCHAR indicating the end of the bitmap for this character.

After all the bitmaps, the end of the file is indicated by the ENDFONT keyword.

Example

The following example lists the beginning of the loadfont input file for an 8 by 16 font, supporting the IBM 437 codeset, as well as the bitmap representation of the character uppercase A.



STARTFONT 2.1
FONT 8x16
SIZE 16 75 75
FONTBOUNDINGBOX 8 16 0 -4
STARTPROPERTIES 3
FONT_DESCENT 4
FONT_ASCENT 12
DEFAULT_CHAR 0
ENDPROPERTIES
CHARS 256
STARTCHAR C0000
ENCODING 0
...

Bitmap for uppercase A character:

STARTCHAR C0041
ENCODING 65
SWIDTH 666 0
DWIDTH 8 0
BBX 8 16 0 -4
BITMAP
00
00
10
38
6c
c6
c6
fe
c6
c6
c6
c6
00
00
00
00
ENDCHAR

Files

/usr/share/lib/*.bdf

See Also

loadfont(1)


Table of Contents