Libnetpbm PPM Drawing Function Manual

Libnetpbm PPM Drawing Function Manual

The Functions
Font File Format
Font Control Functions

Table Of Contents


libnetpbm_draw \- Libnetpbm PPM Drawing Function Manual


This reference manual covers functions in the libnetpbm library for drawing images, using the PPM 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.

The Functions

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



The ppmd_text and ppmd_text_box functions use fonts. You control the fonts using functions described in this section. There is one font that comes with Netpbm, called ’standard’. It is built into the function library and is the default font. You can create additional fonts and use them instead.

In a program that uses Netpbm drawing facilities, there is a ’current font.’ all drawing of text uses the current font. When the program starts, the current font is ’standard’; you can change it after that by calling the ppmd_set_font function.

Other than a built-in font, a font lives in file in a format special to Netpbm called Ppmdfont. The file typically has a name that ends in ’.ppmdfont’.

Use the ppmddumpfont program to dump the contents of a Ppmdfont file in human readable format.

Use the ppmdmkfont program to generate the ’standard’ font as a Ppmdfont file. You don’t normally need to do this, because ’standard’ is built into libnetpbm.

Use the ppmdcfont program to turn a Ppmdfont file into a C source file that you can compile into a program as a built-in font. Though we don’t give full instructions here on how to do that, libnetpbm’s built-in ’standard’ font is a good example. In Netpbm source code, you will find the C source file standardppmdfont.c, which was generated from the file standard.ppmdfont by ppmdcfont. You simply use a pointer to the structure that the C file defines as a font handle, just like one you would get from ppmd_read_font.

Font File Format

The font file starts with the characters ’ppmdfont’ (without the quotation marks) in ASCII.

The rest of the format is not yet documented, but it generally describes, for each code point, a sequence of straight line plotting commands to form the glyph for the indicated character. I.e. it is a vector, not raster, font.

Font Control Functions

These functions are declared in the header file ppmdfont.h.

This function associates a Ppmdfont file, which you identify by naming the Ppmdfont file, with a handle that you can use to identify the font to other functions. Technically, this function reads the font into memory.

This function releases the handle that you get from ppmd_read_font. It frees resources associated with it; you can’t use the handle after this.

This function returns the handle of the currently selected font.

This function sets the currently selected font. You identify the font to which to set it with a handle such as you get from ppmd_read_font or ppmd_get_font.


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.