Glyph Bitmap Distribution Format
Encyclopedia
The Glyph Bitmap Distribution Format (BDF) by Adobe
Adobe Systems
Adobe Systems Incorporated is an American computer software company founded in 1982 and headquartered in San Jose, California, United States...

 is a file format for storing bitmap fonts. The content is presented as a text file that is intended to be human and computer readable. BDF is typically used in Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 environments.

Overview

The current version of BDF is 2.2. No future revisions are anticipated. Earlier versions were referred to as the Character Bitmap Distribution Format.

The X Window Consortium adopted BDF 2.1 as a standard for X Window screen fonts, but is now moving towards other standards.

Version 2.2 added support for non-Western writing. For example, glyph
Glyph
A glyph is an element of writing: an individual mark on a written medium that contributes to the meaning of what is written. A glyph is made up of one or more graphemes....

s in a BDF 2.2 font definition can specify rendering from top-to-bottom rather than simply left-to-right.

A BDF font file contains three sections:
  1. a global section that applies to all glyphs in a font;
  2. a section with a separate entry for each glyph; and
  3. the ENDFONT statement.

Example

This is an example font containing one glyph, for ASCII capital 'A'. This glyph is taken from the GNU Unifont
GNU Unifont
The GNU Unifont by Roman Czyborra is a free bitmap font that covers the Unicode Basic Multilingual Plane , using an intermediate bitmapped font format....

.


STARTFONT 2.1
FONT -gnu-unifont-medium-r-normal--16-160-75-75-c-80-iso10646-1
SIZE 16 75 75
FONTBOUNDINGBOX 16 16 0 -2
STARTPROPERTIES 2
FONT_ASCENT 14
FONT_DESCENT 2
ENDPROPERTIES
CHARS 1
STARTCHAR U+0041
ENCODING 65
SWIDTH 500 0
DWIDTH 8 0
BBX 8 16 0 -2
BITMAP
00
00
00
00
18
24
24
42
42
7E
42
42
42
42
00
00
ENDCHAR
ENDFONT


In the above example, the global declarations begin with the "STARTFONT" line and end with the "CHARS" line.

"STARTFONT 2.1" defines the version of this BDF file as version 2.1.

"FONT -gnu-unifont-medium-r-normal--16-160-75-75-c-80-iso10646-1" defines the font family and face names.

"SIZE 16 75 75" defines this to be a 16 point font, with an X-axis resolution of 75 dots per inch (dpi) and a Y-axis resolution of 75 dpi. This is the norm under X Window.

"FONTBOUNDINGBOX 16 16 0 -2" defines a bounding box for the font of 16 pixels wide by 16 pixels high, with the lower left-hand corner starting at x=0, y=-2. Note that although the bounding box is defined to be a 16 by 16 cell, this can be overridden for individual glyphs. The "A" glyph, for example, is only 8 pixels wide.

"STARTPROPERTIES 2" declares that two special properties will follow. "STARTPROPERTIES" is optional in the BDF specification. X Window allows the properties FONT_ASCENT and FONT_DESCENT to show the height above and below the baseline, respectively, for all glyphs. "FONT_ASCENT 14" declares that 14 of the 16 pixels in height are above the baseline. "FONT_DESCENT 2" declares that 2 of the 16 pixels in height are below the baseline. "ENDPROPERTIES" appears at the end of the "STARTPROPERTIES" section.

"CHARS 1" declares that one character will follow. Although Adobe now refers to this file format as the Glyph BDF, they have retained the keyword "CHARS" in the final version of the specification.

Lines beginning with the word "COMMENT" can be inserted within a BDF file. Anything following the "COMMENT" keyword on a line is ignored.

Following the above global declarations, the following entries are repeated for each glyph.

"STARTCHAR U+0041" specifies the start of a character in version 2.1 and earlier, or of a glyph in version 2.2. The string name of this particular character is "U+0041", which is the Unicode convention for the code point hexadecimal 41 (decimal 65, the ASCII character "A"). In version 2.1 and earlier, the character name string was limited to 14 characters. In version 2.2, the glyph name string can contain up to 65,535 characters.

"ENCODING 65" declares the decimal code point for this glyph in the font.

"SWIDTH 500 0" declares the Scalable Width of 500 on the X-axis and 0 (default) on the Y-axis. This will result in an X-axis offset to the next glyph, but no Y-axis offset to the next glyph (i.e., the glyphs appear straight across in a line). The scalable width is 1000 times the actual point size of the character -- the same unit used in an Adobe Font Metric (AFM) file. The number of pixels calculated as

pixels = (scalable_width / 1000) * (resolution / 72),

where scalable_width is 500 in this example, and resolution is 75 dpi for this font. Because 75 is approximately equal to 72, the number of pixels is the full width of a glyph (defined globally as 16 pixels) times 500 / 1000, or in other words the width of this glyph is 8 pixels.

"DWIDTH 8 0" declares the Device Width of a glyph. In this case, after the glyph is rendered, the start of the next glyph is offset 8 pixels on the X-axis and 0 pixels on the Y-axis from the current glyph origin. Note that the Device Width is not necessarily equal to the width of the glyph. It is simply the offset on the X-axis to move the current point to the start of the next glyph.

The Scalable Width is used to calculate the width of a high-resolution glyph on a printer, whereas the Device Width is used to calculate the width of a glyph on a display device. Thus Scalable Width is specified to greater precision than Device Width.

"BBX 8 16 0 -2" declares a bounding box that is 8 pixels wide and 16 pixels tall. The lower left-hand corner of the character is offset by 0 pixels on the X-axis and -2 pixels on the Y-axis.

"BITMAP" begins the bitmap for the current glyph. This line must be followed by one line per pixel on the Y-axis. In this example the glyph is 16 pixels tall, so 16 lines follow. Each line contains the hexadecimal representation of pixels in a row. A "1" bit indicates a rendered pixel. Each line is rounded to an 8 bit (one byte) boundary, padded with zeroes on the right. In this example, the glyph is exactly 8 pixels wide, and so occupies exactly bits (one byte) per line so that there is no padding. The most significant bit of a line of raster data represents the leftmost pixel.

"ENDCHAR" ends the current glyph.

The declaractions "STARTCHAR" through "ENDCHAR" are repeated for each glyph in a font.

"ENDFONT" appears as the last line in the file, after all glyphs in the font have been enumerated.

Version 2.2 Extensions

Version 2.2 of the BDF specification adds support for non-Western fonts. These additions allow moving the origin by a positive or negative movement on the X and Y axes. This not only accommodates right-to-left writing direction, but even top-to-bottom (for example, for Chinese). The following values provide multinational font support:

METRICSET: set to 0 for writing direction 0, 1 for writing direction 1, or 2 (in the initial global area) for both writing directions within the same font. Traditional Western left-to-right scripts use "METRICSET 0".

SWIDTH1, DWIDTH1: these have the same parameters as SWIDTH and DWIDTH, respectively. DWIDTH1 must be present for a METRICSET 1 glyph. Its offsets can be positive or negative.

VVECTOR defines an X-axis offset and a Y-axis offset to transition from a mode 0 glyph to a mode 1 glyph. An opposite offset is applied during a mode 1 to mode 0 glyph transition.

This scheme easily accommodates two writing directions. Historically, fonts had 128 or 256 code points. Today, Unicode allows for over one million code points. Fonts can conceivably contain thousands of glyphs, some of which should be written left-to-right, some right-to-left, and some top-to-bottom. Such many-direction writing requires creative use of DWIDTH1 and SWIDTH1 for each glyph.

In addition to keywords added for international support, version 2.2 adds the "CONTENTVERSION" declaration. This keyword is followed by an integer to indicate the version number of the font.

For more detailed information, consult the version 2.2 specification.

X Window Properties

X Window font utilities support several properties that can be specified in the STARTPROPERTIES section of a BDF file. A generic BDF file is in ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 encoding. X Window properties are specified using ISO 8859-1
ISO/IEC 8859-1
ISO/IEC 8859-1:1998, Information technology — 8-bit single-byte coded graphic character sets — Part 1: Latin alphabet No. 1, is part of the ISO/IEC 8859 series of ASCII-based standard character encodings, first edition published in 1987. It is informally referred to as Latin-1. It is generally...

 encoding, which is an extension of ASCII. These properties include:
  • CAP_HEIGHT integer -- the height above the baseline of a capital letter (See Cap height
    Cap height
    In typography, cap height refers to the height of a capital letter above the baseline for a particular typeface. It specifically refers to the height of capital letters that are flat—such as H or I—as opposed to round letters such as O, or pointed letters like A, both of which may display...

    ).
  • COPYRIGHT string -- a copyright statement.
  • DEFAULT_CHAR positive -- the default character (glyph) to display for an undefined glyph.
  • FACE_NAME string -- the name of the face for this font.
  • FONT string -- the X Window name of the font.
  • FONT_ASCENT integer -- the height above the baseline
    Baseline (typography)
    In European and West Asian typography and penmanship, the baseline is the line upon which most letters "sit" and below which descenders extend.In the example to the right, the letter 'p' has a descender; the other letters sit on the baseline....

    , for line spacing calculation.
  • FONT_DESCENT integer -- the descender
    Descender
    In typography, a descender is the portion of a letter that extends below the baseline of a font. The line that descenders reach down to is known as the beard line....

     below the baseline, for line spacing calculation.
  • FONT_VERSION string -- the version of the font.
  • FOUNDRY string
  • FAMILY_NAME string -- the font family name.
  • NOTICE string -- a general comment.
  • POINT_SIZE integer -- See Point (typography)
    Point (typography)
    In typography, a point is the smallest unit of measure, being a subdivision of the larger pica. It is commonly abbreviated as pt. The point has long been the usual unit for measuring font size and leading and other minute items on a printed page....

    . If not separately specified, EMspace
    Em (typography)
    An em is a unit of measurement in the field of typography, equal to the currently specified point size.The name of em is related to M. Originally the unit was derived from the width of the capital "M" in the given typeface....

     = round(POINT_SIZE/10), ENspace
    En (typography)
    An en is a typographic unit, half of the width of an em. By definition, it is equivalent to half of the height of the font . As its name suggests, it is also traditionally the width of a lowercase letter "n"....

     = round(POINT_SIZE/20), and THINspace = round(POINT_SIZE/30).
  • RESOLUTION_X positive
  • RESOLUTION_Y positive
  • SLANT string -- "R" is Roman, "I" is Italic, "O" is Oblique, "RI" is Reverse Italic, "RO" is Reverse Oblique, "OT" is Other and a number indicates polymorphic slant capability.
  • WEIGHT_NAME string -- the weight of this font ("Bold" and "Normal" are typical, though there is no set enumeration).
  • X_HEIGHT integer -- the height above the baseline of a lower-case 'x' (See x-height
    X-height
    In typography, the x-height or corpus size refers to the distance between the baseline and the mean line in a typeface. Typically, this is the height of the letter x in the font , as well as the u, v, w, and z...

    ).

...where "integer" is a natural number
Natural number
In mathematics, the natural numbers are the ordinary whole numbers used for counting and ordering . These purposes are related to the linguistic notions of cardinal and ordinal numbers, respectively...

, "positive" is a positive number (of value 1 or higher), and "string" is an ISO 8859-1 character string
String (computer science)
In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....

.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK