# Libnetpbm PBM Font Function Manual

Updated: April 2018

Table Of Contents

This reference manual covers functions in the libnetpbm library for accessing fonts to draw text characters, using the PBM image format and the libnetpbm in-memory image formats.

We actually have very little information here; this is mainly a framework for adding documentation later if someone becomes interested in this facility.

Note that the primary known user of this library is the Netpbm program pbmtext. You can use that program's source code as an example.

## Font Object

libnetpbm represents a font with an object of type struct font. The library provides functions to create these objects.

The object these functions create is in newly allocated memory and you can't actually free it. The memory may be in multiple pieces, pointing to each other, and libnetpbm provides no destroy function. (This is only because of implementation laziness).

## The Functions

The functions are all declared in the pbmfont.h header file.

### pbm_defaultfont

#### Synopsis

        struct font *
        pbm_defaultfont(const char * which);

#### Description

This returns a font object representing a font built in to libnetpbm.

which is the name of the desired built-in font. There are two:

bdf
  A proportional font similar to Adobe's timR12 font
fixed
  A fixed space font

#### Copyright

The provenance of the built-in fonts are not known for sure, but in 2018, the bdf font was almost identical to a font on which Adobe and Digital Equipment Corporation once claimed copyright. That font was available in the X.org source code in a collection named "font-adobe-75dpi", in a file named timR12.pcf.gz.

Ergo, it is likely that the font was copied into Netpbm from that font in 1991.

You may need a copyright license from the copyright owners of that original font not only to copy the libnetpbm code, but to execute it, thus generating copies of the glyphs of the font.

The X.org files in 2018 indicate the following copyright claims, along with a license to the public to copy them:

> Copyright 1984-1989, 1994 Adobe Systems Incorporated. Copyright 1988, 1994 Digital Equipment Corporation.

> Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notices appear in all copies and that both those copyright notices and this permission notice appear in supporting documentation, and that the names of Adobe Systems and Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Adobe Systems and Digital Equipment Corporation make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.

### pbm_dissectfont

### pbm_loadfont

This function returns a font object for a font described in a file. The file may be either a special PBM file or a BDF file. The function determines which it is and behaves as either pbm_loadpbmfont or pbm_loadbdffont accordingly.

### pbm_loadpbmfont

### pbm_loadbdffont2

### pbm_loadbdffont

This is obsolete. New programs should use pbm_loadbdffont2 instead.

### pbm_expandbdffont

### pbm_dumpfont

## Table Of Contents

- Font Object
- The Functions
  - pbm_default_font
  - pbm_dissectfont
  - pbm_loadfont
  - pbm_loadpbmfont
  - pbm_loadbdffont2
  - pbm_loadbdffont
  - pbm_expandbdffont
  - pbm_dumpfont