2000-10-30 21:46:41 +01:00
|
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
|
|
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
2000-10-26 01:42:02 +02:00
|
|
|
<html>
|
2000-10-30 21:46:41 +01:00
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type"
|
|
|
|
content="text/html; charset=iso-8859-1">
|
|
|
|
<meta name="Author"
|
|
|
|
content="David Turner">
|
2000-11-10 23:39:21 +01:00
|
|
|
<title>The design of FreeType 2</title>
|
2000-10-26 01:42:02 +02:00
|
|
|
</head>
|
2000-10-30 21:46:41 +01:00
|
|
|
|
|
|
|
<body text="#000000"
|
2000-11-10 23:39:21 +01:00
|
|
|
bgcolor="#FFFFFF"
|
|
|
|
link="#0000EF"
|
|
|
|
vlink="#51188E"
|
|
|
|
alink="#FF0000">
|
2000-10-30 21:46:41 +01:00
|
|
|
|
|
|
|
<h1 align=center>
|
2000-11-10 23:39:21 +01:00
|
|
|
The design of FreeType 2
|
2000-10-30 21:46:41 +01:00
|
|
|
</h1>
|
|
|
|
|
2000-11-10 23:39:21 +01:00
|
|
|
<h3 align=center>
|
|
|
|
Copyright 1998-2000 David Turner (<a
|
|
|
|
href="mailto:david@freetype.org">david@freetype.org</a>)<br>
|
|
|
|
Copyright 2000 The FreeType Development Team (<a
|
|
|
|
href="mailto:devel@freetype.org">devel@freetype.org</a>)
|
|
|
|
</h3>
|
|
|
|
|
2000-10-30 21:46:41 +01:00
|
|
|
<center>
|
2000-11-10 23:39:21 +01:00
|
|
|
<table width="65%">
|
2000-10-30 21:46:41 +01:00
|
|
|
<tr><td>
|
|
|
|
|
2000-11-10 23:39:21 +01:00
|
|
|
<center>
|
|
|
|
<table width="100%"
|
|
|
|
border=0
|
|
|
|
cellpadding=5>
|
|
|
|
<tr bgcolor="#CCFFCC"
|
|
|
|
valign=center>
|
|
|
|
<td align=center
|
|
|
|
width="30%">
|
|
|
|
<a href="design-1.html">Previous</a>
|
|
|
|
</td>
|
|
|
|
<td align=center
|
|
|
|
width="30%">
|
|
|
|
<a href="index.html">Contents</a>
|
|
|
|
</td>
|
|
|
|
<td align=center
|
|
|
|
width="30%">
|
|
|
|
<a href="design-3.html">Next</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</center>
|
|
|
|
|
|
|
|
<p><hr></p>
|
2000-11-09 02:14:31 +01:00
|
|
|
|
2000-10-30 21:46:41 +01:00
|
|
|
<table width="100%">
|
|
|
|
<tr bgcolor="#ccccee"><td>
|
|
|
|
<h1>
|
|
|
|
I. Components and APIs
|
|
|
|
</h1>
|
|
|
|
</td></tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<p>It's better to describe FreeType 2 as a collection of
|
|
|
|
<em>components</em>. Each one of them is a more or less abstract part of
|
|
|
|
the library that is in charge of one specific task. We will now explicit
|
|
|
|
the connections and relationships between them.</p>
|
|
|
|
|
|
|
|
<p>A first brief description of this system of components could be:</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<p>Client applications typically call the FreeType 2
|
|
|
|
<b>high-level API</b>, whose functions are implemented in a single
|
|
|
|
component called the <em>Base Layer</em>.</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<p>Depending on the context or the task, the base layer then calls one
|
|
|
|
or more <em>module</em> components to perform the work. In most
|
|
|
|
cases, the client application doesn't need to know which module was
|
|
|
|
called.</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<p>The base layer also contains a set of routines that are used for
|
|
|
|
generic things like memory allocation, list processing, i/o stream
|
|
|
|
parsing, fixed point computation, etc. these functions can also be
|
|
|
|
called by a module at any time, and they form what is called the
|
|
|
|
<b>low-level base API</b>.</p>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p>This is illustrated by the following graphics (note that component
|
|
|
|
entry points are represented as colored triangles):</p>
|
|
|
|
|
|
|
|
<center>
|
|
|
|
<img src="basic-design.png"
|
|
|
|
width="394" height="313"
|
|
|
|
alt="Basic FreeType design">
|
|
|
|
</center>
|
|
|
|
|
|
|
|
<p>Now, a few additional things must be added to complete this
|
|
|
|
picture:</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<p>Some parts of the base layer can be replaced for specific builds of
|
2000-10-31 21:42:18 +01:00
|
|
|
the library, and can thus be considered as components themselves.
|
2000-10-30 21:46:41 +01:00
|
|
|
This is the case for the <tt>ftsystem</tt> component, which is in
|
|
|
|
charge of implementing memory management & input stream access, as
|
|
|
|
well as <tt>ftinit</tt>, which is in charge of library initialization
|
|
|
|
(i.e. implementing the <tt>FT_Init_FreeType()</tt> function).</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<p>FreeType 2 comes also with a set of <em>optional
|
|
|
|
components</em>, which can be used either as a convenience for client
|
|
|
|
applications (e.g. the <tt>ftglyph</tt> component, used to provide a
|
|
|
|
simple API to manage glyph images independently of their internal
|
|
|
|
representation), or to access format-specific features (e.g. the
|
|
|
|
<tt>ftmm</tt> component used to access and manage Multiple Masters
|
|
|
|
data in Type 1 fonts).</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<p>Finally, a module is capable of calling functions provided by
|
|
|
|
another module. This is very useful to share code and tables between
|
|
|
|
several font driver modules (for example, the <tt>truetype</tt> and
|
|
|
|
<tt>cff</tt> modules both use the routines provided by the
|
|
|
|
<tt>sfnt</tt> module).</p>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p>Hence, a more complete picture would be:</p>
|
|
|
|
|
|
|
|
<center>
|
|
|
|
<img src="detailed-design.png"
|
|
|
|
width="390" height="429"
|
|
|
|
alt="Detailed FreeType design">
|
|
|
|
</center>
|
|
|
|
|
|
|
|
<p>Please take note of the following important points:</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<p>An optional component can use either the high-level or base API.
|
|
|
|
This is the case of <tt>ftglyph</tt> in the above picture.</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<p>Some optional components can use module-specific interfaces ignored
|
|
|
|
by the base layer. In the above example, <tt>ftmm</tt> directly
|
|
|
|
accesses the Type 1 module to set/query data.</p>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<p>A replacable component can provide a function of the high-level
|
|
|
|
API. For example, <tt>ftinit</tt> provides
|
|
|
|
<tt>FT_Init_FreeType()</tt> to client applications.</p>
|
2000-10-31 21:42:18 +01:00
|
|
|
</li>
|
2000-10-30 21:46:41 +01:00
|
|
|
</ul>
|
|
|
|
|
2000-11-10 23:39:21 +01:00
|
|
|
<p><hr></p>
|
|
|
|
|
|
|
|
<center>
|
|
|
|
<table width="100%"
|
|
|
|
border=0
|
|
|
|
cellpadding=5>
|
|
|
|
<tr bgcolor="#CCFFCC" valign=center>
|
|
|
|
<td align=center
|
|
|
|
width="30%">
|
|
|
|
<a href="design-1.html">Previous</a>
|
|
|
|
</td>
|
|
|
|
<td align=center
|
|
|
|
width="30%">
|
|
|
|
<a href="index.html">Contents</a>
|
|
|
|
</td>
|
|
|
|
<td align=center
|
|
|
|
width="30%">
|
|
|
|
<a href="design-3.html">Next</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</center>
|
2000-11-09 02:14:31 +01:00
|
|
|
|
2000-10-30 21:46:41 +01:00
|
|
|
</td></tr>
|
|
|
|
</table>
|
|
|
|
</center>
|
2000-11-10 23:39:21 +01:00
|
|
|
|
2000-10-26 01:42:02 +02:00
|
|
|
</body>
|
|
|
|
</html>
|