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 FT2 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:

  • first of all, to allow client applications to access font files easily, wherever they could be stored, and as independently of font format as possible.

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

  • to allow easy retrieval of individual glyph data (metrics, images, name, anything else)

  • to allow 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, as 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.

  • extendibility, as new features should be added with the least modifications in the library's code base. this requirements 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, given that the primary target for this library is 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 initialisation & compilation to your needs.