The Design of FreeType 2

Introduction

This document provides details on the design and implementation of the FreeType 2 library. Its goal is to allow developers to better understand the way how FreeType 2 is organized, in order to let them extend, customize, and debug it.

Before anything else, it is important to understand the purpose of this library, i.e., why it has been written:

  • It allows client applications to access font files easily, wherever they could be stored, and as independently of the font format as possible.

  • Easy retrieval of global font data most commonly found in normal font formats (i.e. global metrics, encoding/charmaps, etc.).

  • It allows easy retrieval of individual glyph data (metrics, images, name, anything else).

  • Access to font format-specific "features" whenever possible (e.g. SFNT tables, Multiple Masters, OpenType Layout tables, etc.).

Its design has also severely been influenced by the following requirements:

  • High portability. The library must be able to run on any kind of environment. This requirement introduces a few drastic choices that are part of FreeType 2's low-level system interface.

  • Extendability. New features should be added with the least modifications in the library's code base. This requirement induces an extremely simple design where nearly all operations are provided by modules.

  • Customization. It should be easy to build a version of the library that only contains the features needed by a specific project. This really is important when you need to integrate it in a font server for embedded graphics libraries.

  • Compactness and efficiency. The primary target for this library are embedded systems with low cpu and memory resources.

The rest of this document is divided in several sections. First, a few chapters will present the library's basic design as well as the objects/data managed internally by FreeType 2.

A later section is then dedicated to library customization, relating such topics as system-specific interfaces, how to write your own module and how to tailor library initialization & compilation to your needs.