Update to freetype-doc-2.9.1
This commit is contained in:
parent
1fbe271042
commit
5d55788f87
@ -267,8 +267,15 @@ table {
|
||||
/* the next two lines center the table horizontally */
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 5ex;
|
||||
margin-bottom: 5ex; }
|
||||
margin-top: 0;
|
||||
margin-bottom: 0; }
|
||||
table.vertical-space {
|
||||
border-collapse: collapse;
|
||||
/* the next two lines center the table horizontally */
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 4ex;
|
||||
margin-bottom: 4ex; }
|
||||
td {
|
||||
padding-left: 0.8em;
|
||||
padding-right: 0.8em; }
|
||||
@ -282,7 +289,17 @@ th {
|
||||
padding-bottom: 1ex; }
|
||||
tbody tr:first-child td {
|
||||
/* some vertical space after the horizontal rule */
|
||||
/* or at the beginning of the table */
|
||||
padding-top: 1ex; }
|
||||
tbody tr:last-child td {
|
||||
/* some vertical space after the table */
|
||||
padding-bottom: 1ex; }
|
||||
/* if we have paragraphs in a table, */
|
||||
/* suppress first and last vertical space */
|
||||
table tr:first-of-type p:first-of-type {
|
||||
margin-top: 0; }
|
||||
table tr:last-of-type p:last-of-type {
|
||||
margin-bottom: 0; }
|
||||
|
||||
dl {
|
||||
margin-left: 1em; }
|
||||
@ -293,9 +310,9 @@ dt {
|
||||
/* if we have paragraphs in definition lists, */
|
||||
/* suppress the very first vertical space */
|
||||
dd > p:first-child {
|
||||
margin-top: 0ex; }
|
||||
margin-top: 0; }
|
||||
dd > p {
|
||||
margin-bottom: 0ex; }
|
||||
margin-bottom: 0; }
|
||||
|
||||
/* indented text */
|
||||
div.quote {
|
||||
@ -326,6 +343,9 @@ div.updated {
|
||||
margin-top: 5ex;
|
||||
font-style: italic;
|
||||
font-size: 70%; }
|
||||
p {
|
||||
margin-top: 1ex;
|
||||
margin-bottom: 1ex; }
|
||||
p.warning {
|
||||
color: red; }
|
||||
p.large {
|
||||
|
@ -1,160 +1,237 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Style-Type"
|
||||
content="text/css">
|
||||
<meta http-equiv="Content-Script-Type"
|
||||
content="text/javascript">
|
||||
<meta name="description"
|
||||
content="FreeType Documentation">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
|
||||
<link rel="icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="shortcut icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../css/freetype2_-90.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery-1.11.0.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery.ba-resize.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/freetype2.js">
|
||||
</script>
|
||||
|
||||
<title>FreeType Design</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
<body>
|
||||
|
||||
<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>
|
||||
<div id="top"
|
||||
class="bar">
|
||||
<h1><a href="http://freetype.org/index.html">FreeType</a> Design</h1>
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-2.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<div id="wrapper">
|
||||
|
||||
<p><hr></p>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colright">
|
||||
<div class="col1wrap">
|
||||
<div class="col1">
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
Introduction
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>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.</p>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="introduction">
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<p>This document provides details on the design and
|
||||
implementation of the FreeType 2 library. Its goal
|
||||
is to help developers better understand how
|
||||
FreeType 2 is organized, in order to let them extend,
|
||||
customize, and debug it.</p>
|
||||
|
||||
<p>Before anything else, it is important to understand the
|
||||
<em>purpose</em> of this library, i.e., why it has been written:</p>
|
||||
<em>purpose</em> of this library, i.e., why it has been
|
||||
written.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>It allows client applications to <em>access font files easily</em>,
|
||||
wherever they could be stored, and as independently of the font format
|
||||
as possible.</p>
|
||||
<p>It allows client applications to <em>access font
|
||||
files easily</em>, wherever they could be stored, and
|
||||
as independently of the font format as possible.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Easy <em>retrieval of global font data</em> most commonly found in
|
||||
normal font formats (i.e. global metrics, encoding/charmaps,
|
||||
etc.).</p>
|
||||
<p>Easy <em>retrieval of global font data</em> most
|
||||
commonly found in normal font formats (i.e., global
|
||||
metrics, encoding/charmaps, etc.).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>It allows easy <em>retrieval of individual glyph data</em>
|
||||
(metrics, images, name, anything else).</p>
|
||||
<p>It allows easy <em>retrieval of individual glyph
|
||||
data</em> (metrics, images, name, anything else).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Access to font format-specific "features"</em> whenever
|
||||
possible (e.g. SFNT tables, Multiple Masters, OpenType Layout tables,
|
||||
etc.).</p>
|
||||
<p><em>Access to font format-specific
|
||||
‘features’</em> whenever possible (e.g.,
|
||||
SFNT tables, Multiple Masters, OpenType layout tables,
|
||||
font variations, etc.).</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Its design has also severely been influenced by the following
|
||||
requirements:</p>
|
||||
<p>Its design has also severely been influenced by the
|
||||
following requirements.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><em>High portability</em>. 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.</p>
|
||||
<p><em>High portability</em>. 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.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Extendability</em>. 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.</p>
|
||||
<p><em>Extendability</em>. 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 or services.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Customization</b>. 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.</p>
|
||||
<p><em>Customization</em>. 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 into a font
|
||||
server for embedded graphics libraries, say.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Compactness</em> and <em>efficiency</em>. The primary target
|
||||
for this library are embedded systems with low cpu and memory
|
||||
resources.</p>
|
||||
<p><em>Compactness</em> and <em>efficiency</em>. The
|
||||
primary target for this library originally were
|
||||
embedded systems with low CPU and memory resources.
|
||||
Today, however, memory constraints are much less
|
||||
strict, and the focus of development shifted to
|
||||
support as much font features as possible.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>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.</p>
|
||||
<p>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 and data managed internally
|
||||
by FreeType 2.</p>
|
||||
|
||||
<p>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.</p>
|
||||
<p>It is intended to eventually add sections that cover
|
||||
library customization, relating to topics as
|
||||
system-specific interfaces, how to write your own modules
|
||||
or services and how to tailor library initialization and
|
||||
compilation to your needs. Those sections are not written
|
||||
yet, however.</p>
|
||||
</div>
|
||||
|
||||
<p><hr></p>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</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>
|
||||
<div class="updated">
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="col2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html#news">News</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../index.html">Overview</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../documentation.html">Documentation</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/developer.html">Development</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/contact.html"
|
||||
class="emphasis">Contact</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- separate primary from secondary entries -->
|
||||
</li>
|
||||
|
||||
<li class="secondary">
|
||||
<a href="index.html">FreeType Design</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-1.html" class="current">Introduction</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-2.html">Components and APIs</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-3.html">Public Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-4.html">Internal Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-5.html">Module Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-6.html">Interfaces and Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div> <!-- id="wrapper" -->
|
||||
|
||||
<div id="TOC-bottom">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,187 +1,292 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Style-Type"
|
||||
content="text/css">
|
||||
<meta http-equiv="Content-Script-Type"
|
||||
content="text/javascript">
|
||||
<meta name="description"
|
||||
content="FreeType Documentation">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
|
||||
<link rel="icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="shortcut icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../css/freetype2_-90.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery-1.11.0.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery.ba-resize.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/freetype2.js">
|
||||
</script>
|
||||
|
||||
<title>FreeType Design / I</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
<body>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:david@freetype.org">david@freetype.org</a>)<br>
|
||||
Copyright 2000, 2007 The FreeType Development Team (<a
|
||||
href="mailto:devel@freetype.org">devel@freetype.org</a>)
|
||||
</h3>
|
||||
<div id="top"
|
||||
class="bar">
|
||||
<h1><a href="http://freetype.org/index.html">FreeType</a>
|
||||
Design / I</h1>
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<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>
|
||||
<div id="wrapper">
|
||||
|
||||
<p><hr></p>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colright">
|
||||
<div class="col1wrap">
|
||||
<div class="col1">
|
||||
|
||||
<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>
|
||||
<div id="components-and-apis">
|
||||
<h2>I. Components and APIs</h2>
|
||||
|
||||
<p>It is 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 explain the connections and
|
||||
relationships between them.</p>
|
||||
|
||||
<p>A first brief description of this system of components
|
||||
could be as follows.</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>
|
||||
<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
|
||||
<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>
|
||||
<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>
|
||||
<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"
|
||||
width="394"
|
||||
height="313"
|
||||
alt="Basic FreeType design">
|
||||
</center>
|
||||
|
||||
<p>Now, a few additional things must be added to complete this
|
||||
picture:</p>
|
||||
<p>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
|
||||
the library, and can thus be considered as components themselves.
|
||||
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>
|
||||
<p>Some parts of the base layer can be replaced for
|
||||
specific builds of the library, and can thus be
|
||||
considered as components themselves. This is the case
|
||||
for the <tt>ftsystem</tt> component, which is in
|
||||
charge of implementing memory management and input
|
||||
stream access, as well as <tt>ftinit</tt>, which is in
|
||||
charge of library initialization (i.e., implementing
|
||||
the <a href="../reference/ft2-base_interface.html#FT_Init_FreeType"><code>FT_Init_FreeType</code></a>
|
||||
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>
|
||||
components</em>, which can be used either as a
|
||||
convenience layer 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 and OpenType variations 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>
|
||||
<p>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>
|
||||
<li>
|
||||
<p>Finally, FreeType provides <em>services</em>, which
|
||||
are a more light-weight way to access certain features
|
||||
across multiple modules, or to access some
|
||||
functionality provided by a single module.</p>
|
||||
|
||||
<p>Services are internal to FreeType; similar to
|
||||
modules, it is necessary to ‘load’ a
|
||||
service, which can fail if the service's module is not
|
||||
available.</p>
|
||||
|
||||
<p>An example for a service provided by a single module
|
||||
is ‘winfonts’ (see
|
||||
file <tt>svwinfnt.h</tt>), which allows access to the
|
||||
header of Windows bitmap fonts. An example for a
|
||||
service provided by multiple modules is
|
||||
‘multi-masters’ (see file <tt>svmm.h</tt>)
|
||||
to manage the abovementioned <tt>ftmm</tt> component
|
||||
across the <tt>truetype</tt>, <tt>type1</tt>,
|
||||
and <tt>cff</tt> modules.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Hence, a more complete picture would be:</p>
|
||||
<p>The following graphics shows the additional components
|
||||
(without services).</p>
|
||||
|
||||
<center>
|
||||
<img src="detailed-design.png"
|
||||
width="390" height="429"
|
||||
width="390"
|
||||
height="429"
|
||||
alt="Detailed FreeType design">
|
||||
</center>
|
||||
|
||||
<p>Please take note of the following important points:</p>
|
||||
<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>
|
||||
<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>
|
||||
<p>Some optional components can use module-specific
|
||||
interfaces or services ignored by the base layer. In
|
||||
the above example, <tt>ftmm</tt> directly accesses the
|
||||
Type 1 and TrueType modules to set and query
|
||||
data.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A replaceable 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>
|
||||
<p>A replaceable 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>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<div class="updated">
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="col2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html#news">News</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../index.html">Overview</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../documentation.html">Documentation</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/developer.html">Development</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/contact.html"
|
||||
class="emphasis">Contact</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- separate primary from secondary entries -->
|
||||
</li>
|
||||
|
||||
<li class="secondary">
|
||||
<a href="index.html">FreeType Design</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-1.html">Introduction</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-2.html" class="current">Components and APIs</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-3.html">Public Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-4.html">Internal Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-5.html">Module Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-6.html">Interfaces and Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div> <!-- id="wrapper" -->
|
||||
|
||||
<div id="TOC-bottom">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,353 +1,444 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Style-Type"
|
||||
content="text/css">
|
||||
<meta http-equiv="Content-Script-Type"
|
||||
content="text/javascript">
|
||||
<meta name="description"
|
||||
content="FreeType Documentation">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
|
||||
<link rel="icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="shortcut icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../css/freetype2_-90.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery-1.11.0.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery.ba-resize.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/freetype2.js">
|
||||
</script>
|
||||
|
||||
<title>FreeType Design / II</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
<body>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:david@freetype.org">david@freetype.org</a>)<br>
|
||||
Copyright 2000, 2007 The FreeType Development Team (<a
|
||||
href="mailto:devel@freetype.org">devel@freetype.org</a>)
|
||||
</h3>
|
||||
<div id="top"
|
||||
class="bar">
|
||||
<h1><a href="http://freetype.org/index.html">FreeType</a>
|
||||
Design / II</h1>
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-2.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<div id="wrapper">
|
||||
|
||||
<p><hr></p>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colright">
|
||||
<div class="col1wrap">
|
||||
<div class="col1">
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
II. Public Objects and Classes
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>We will now explain the abstractions provided by FreeType 2 to
|
||||
client applications to manage font files and data. As you would normally
|
||||
expect, these are implemented through objects/classes.</p>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<h2>
|
||||
1. Object Orientation in FreeType 2
|
||||
</h2>
|
||||
<div id="public-objects">
|
||||
<h2>II. Public Objects and Classes</h2>
|
||||
|
||||
<p>Though written in ANSI C, the library employs a few techniques,
|
||||
inherited from object-oriented programming, to make it easy to extend.
|
||||
Hence, the following conventions apply in the FreeType 2 source
|
||||
code:</p>
|
||||
<p>We will now explain the abstractions provided by
|
||||
FreeType 2 to client applications to manage font
|
||||
files and data. As you would normally expect, these are
|
||||
implemented through objects and classes.</p>
|
||||
|
||||
|
||||
<h3 id="section-1">1. Object Orientation in
|
||||
FreeType 2</h3>
|
||||
|
||||
<p>Though written in ANSI C, the library employs a few
|
||||
techniques, inherited from object-oriented programming, to
|
||||
make it easy to extend. Hence, the following conventions
|
||||
apply in the FreeType 2 source code.</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<p>Each object type/class has a corresponding <em>structure
|
||||
type</em> <b>and</b> a corresponding <em>structure pointer
|
||||
type</em>. The latter is called the <em>handle type</em> for the
|
||||
type/class.</p>
|
||||
<p>Almost all object types or classes have a
|
||||
corresponding <em>structure type</em> <b>and</b> a
|
||||
corresponding <em>structure pointer type</em>. The
|
||||
latter is called the <em>handle type</em> for the type
|
||||
or class.</p>
|
||||
|
||||
<p>Consider that we need to manage objects of type "foo" in
|
||||
FreeType 2. We would define the following structure and handle
|
||||
types as follows:</p>
|
||||
<p>Consider that we need to manage objects of type
|
||||
‘foo’ in FreeType 2. We would define
|
||||
the following structure and handle types as
|
||||
follows.</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
typedef struct FT_FooRec_* FT_Foo;
|
||||
<pre>
|
||||
typedef struct FT_FooRec_* FT_Foo;
|
||||
|
||||
typedef struct FT_FooRec_
|
||||
{
|
||||
// fields for the "foo" class
|
||||
typedef struct FT_FooRec_
|
||||
{
|
||||
/* fields for the 'foo' class */
|
||||
...
|
||||
|
||||
} FT_FooRec;</pre>
|
||||
</font>
|
||||
} FT_FooRec;</pre>
|
||||
|
||||
<p>As a convention, handle types use simple but meaningful
|
||||
identifiers beginning with <tt>FT_</tt>, as in <tt>FT_Foo</tt>,
|
||||
while structures use the same name with a <tt>Rec</tt> suffix
|
||||
appended to it ("Rec" is short for "record"). <em>Note that each
|
||||
class type has a corresponding handle type</em>.</p>
|
||||
<p>As a convention, handle types use simple but
|
||||
meaningful identifiers beginning with <tt>FT_</tt>, as
|
||||
in <tt>FT_Foo</tt>, while structures use the same name
|
||||
with a <tt>Rec</tt> suffix appended to it
|
||||
(‘Rec’ is short for
|
||||
‘record’).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Class derivation is achieved internally by wrapping base class
|
||||
structures into new ones. As an example, we define a "foobar" class
|
||||
that is derived from "foo". We would do something like:</p>
|
||||
<p>Class derivation is achieved internally by wrapping
|
||||
base class structures into new ones. As an example,
|
||||
we define a ‘foobar’ class that is derived
|
||||
from ‘foo’. We would do something
|
||||
like this.</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
typedef struct FT_FooBarRec_* FT_FooBar;
|
||||
<pre>
|
||||
typedef struct FT_FooBarRec_* FT_FooBar;
|
||||
|
||||
typedef struct FT_FooBarRec_
|
||||
{
|
||||
// the base "foo" class fields
|
||||
typedef struct FT_FooBarRec_
|
||||
{
|
||||
/* the base 'foo' class fields */
|
||||
FT_FooRec root;
|
||||
|
||||
// fields proper to the "foobar" class
|
||||
/* fields proper to the 'foobar' class */
|
||||
...
|
||||
} FT_FooBarRec;</pre>
|
||||
</font>
|
||||
} FT_FooBarRec;</pre>
|
||||
|
||||
<p>As you can see, we ensure that a "foobar" object is also a "foo"
|
||||
object by placing a <tt>FT_FooRec</tt> at the start of the
|
||||
<tt>FT_FooBarRec</tt> definition. It is called <b>root</b> by
|
||||
convention.</p>
|
||||
<p>As you can see, we ensure that a ‘foobar’
|
||||
object is also a ‘foo’ object by placing
|
||||
a <tt>FT_FooRec</tt> at the start of the
|
||||
<tt>FT_FooBarRec</tt> definition. It is
|
||||
called <b>root</b> by convention.</p>
|
||||
|
||||
<p>Note that a <tt>FT_FooBar</tt> handle also points to a "foo"
|
||||
object and can be typecasted to <tt>FT_Foo</tt>. Similarly, when
|
||||
the library returns a <tt>FT_Foo</tt> handle to client applications,
|
||||
the object can be really implemented as a <tt>FT_FooBar</tt> or any
|
||||
derived class from "foo".</p>
|
||||
<p>Note that an <tt>FT_FooBar</tt> handle also points to
|
||||
a ‘foo’ object and can be typecast
|
||||
to <tt>FT_Foo</tt>. Similarly, when the library
|
||||
returns an <tt>FT_Foo</tt> handle to client
|
||||
applications, the object can be really implemented as
|
||||
<tt>FT_FooBar</tt> or any derived class from
|
||||
‘foo’.</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>In the following sections of this chapter, we will refer to "the
|
||||
<tt>FT_Foo</tt> class" to indicate the type of objects handled through
|
||||
<tt>FT_Foo</tt> pointers, be they implemented as "foo" or "foobar".</p>
|
||||
<p>In the following sections of this chapter, we will refer
|
||||
to ‘the <tt>FT_Foo</tt> class’ to indicate the
|
||||
type of objects handled through <tt>FT_Foo</tt> pointers,
|
||||
be they implemented as ‘foo’ or
|
||||
‘foobar’.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
2. The <tt>FT_Library</tt> class
|
||||
</h2>
|
||||
<h3 id="section-2">2. The <tt>FT_Library</tt> class</h3>
|
||||
|
||||
<p>This type corresponds to a handle to a single instance of the
|
||||
library. Note that the corresponding structure <tt>FT_LibraryRec</tt>
|
||||
is not defined in public header files, making client applications unable
|
||||
to access its internal fields.</p>
|
||||
<p>This type corresponds to a handle to a single instance of
|
||||
the library. Note that the corresponding
|
||||
structure <tt>FT_LibraryRec</tt> is not defined in public
|
||||
header files, making client applications unable to access
|
||||
its internal fields.</p>
|
||||
|
||||
<p>The library object is the <em>parent</em> of all other objects in
|
||||
FreeType 2. You need to create a new library instance before doing
|
||||
anything else with the library. Similarly, destroying it will
|
||||
automatically destroy all its children (i.e. faces and modules).</p>
|
||||
<p>The library object is the <em>parent</em> of all other
|
||||
objects in FreeType 2. You need to create a new
|
||||
library instance before doing anything else with the
|
||||
library. Similarly, destroying it will automatically
|
||||
destroy all its children (i.e., faces and modules).</p>
|
||||
|
||||
<p>Typical client applications should call <tt>FT_Init_FreeType()</tt>
|
||||
in order to create a new library object, ready to be used for further
|
||||
actions.</p>
|
||||
<p>Typical client applications should
|
||||
call <a href="../reference/ft2-base_interface.html#FT_Init_FreeType"><code>FT_Init_FreeType</code></a>
|
||||
in order to create a new library object, ready to be used
|
||||
for further actions.</p>
|
||||
|
||||
<p>Another alternative is to create a fresh new library instance by
|
||||
calling the function <tt>FT_New_Library()</tt>, defined in the
|
||||
<tt><freetype/ftmodule.h></tt> public header file. This function
|
||||
will however return an "empty" library instance with no module
|
||||
registered in it. You can "install" modules in the instance by calling
|
||||
<tt>FT_Add_Module()</tt> manually.</p>
|
||||
<p>Another alternative is to create a fresh new library
|
||||
instance by calling the function
|
||||
<a href="../reference/ft2-module_management.html#FT_New_Library"><code>FT_New_Library</code></a>,
|
||||
defined in the
|
||||
<tt>ftmodule.h</tt> public header file. This function
|
||||
will however return an ‘empty’ library
|
||||
instance with no module registered in it. You can
|
||||
‘install’ modules in the instance by calling
|
||||
<a href="../reference/ft2-module_management.html#FT_Add_Module"><code>FT_Add_Module</code></a>
|
||||
manually.</p>
|
||||
|
||||
<p>Calling <tt>FT_Init_FreeType()</tt> is a lot more convenient, because
|
||||
this function basically registers a set of default modules into each new
|
||||
library instance. The way this list is accessed and/or computed is
|
||||
determined at build time, and depends on the content of the
|
||||
<tt>ftinit</tt> component. This process is explained in details later
|
||||
in this document.</p>
|
||||
<p>Calling <tt>FT_Init_FreeType</tt> is a lot more
|
||||
convenient, because this function basically registers a
|
||||
set of default modules into each new library instance.
|
||||
The way this list is accessed or computed is determined at
|
||||
build time, and depends on the content of
|
||||
the <tt>ftinit</tt> component. This process is explained
|
||||
in details later in this document.</p>
|
||||
|
||||
<p>For now, one should consider that library objects are created with
|
||||
<tt>FT_Init_FreeType()</tt>, and destroyed along with all children with
|
||||
<tt>FT_Done_FreeType()</tt>.</p>
|
||||
<p>For now, one should consider that library objects are
|
||||
created with <tt>FT_Init_FreeType</tt>, and destroyed
|
||||
along with all children
|
||||
with <a href="../reference/ft2-base_interface.html#FT_Done_FreeType"><code>FT_Done_FreeType</code></a>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
3. The <tt>FT_Face</tt> class
|
||||
</h2>
|
||||
<h3 id="section-3">3. The <tt>FT_Face</tt> class</h3>
|
||||
|
||||
<p>A face object corresponds to a single <em>font face</em>, i.e., a
|
||||
specific typeface with a specific style. For example, "Arial" and
|
||||
"Arial Italic" correspond to two distinct faces.</p>
|
||||
<p>A face object corresponds to a single <em>font face</em>,
|
||||
i.e., a specific typeface with a specific style. For
|
||||
example, ‘Arial’ and ‘Arial
|
||||
Italic’ correspond to two distinct faces.</p>
|
||||
|
||||
<p>A face object is normally created through <tt>FT_New_Face()</tt>.
|
||||
This function takes the following parameters: an <tt>FT_Library</tt>
|
||||
handle, a C file pathname used to indicate which font file to open, an
|
||||
index used to decide which face to load from the file (a single file may
|
||||
contain several faces in certain cases), and the address of a
|
||||
<tt>FT_Face</tt> handle. It returns an error code:</p>
|
||||
<p>A face object is normally created
|
||||
through <a href="../reference/ft2-base_interface.html#FT_New_Face"><code>FT_New_Face</code></a>.
|
||||
This function takes the following parameters:
|
||||
an <tt>FT_Library</tt> handle, a C file pathname used to
|
||||
indicate which font file to open, an index used to decide
|
||||
which face to load from the file (a single file may
|
||||
contain several faces in certain cases), and the address
|
||||
of an <tt>FT_Face</tt> handle. It returns an error
|
||||
code.</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
FT_Error FT_New_Face( FT_Library library,
|
||||
<pre>
|
||||
FT_Error FT_New_Face( FT_Library library,
|
||||
const char* filepathname,
|
||||
FT_Long face_index,
|
||||
FT_Face* face );</pre>
|
||||
</font>
|
||||
|
||||
<p>In case of success, the function will return 0, and the handle
|
||||
pointed to by the <tt>face</tt> parameter will be set to a non-NULL
|
||||
value.</p>
|
||||
<p>In case of success, the function
|
||||
returns <tt>FT_Err_Ok</tt> (which is value 0), and
|
||||
the handle pointed to by the <tt>face</tt> parameter is
|
||||
set to a non-NULL value.</p>
|
||||
|
||||
<p>Note that the face object contains several fields used to describe
|
||||
global font data that can be accessed directly by client applications.
|
||||
For example, the total number of glyphs in the face, the face's family
|
||||
name, style name, the EM size for scalable formats, etc. For more
|
||||
details, look at the <tt>FT_FaceRec</tt> definition in the
|
||||
FreeType 2 API Reference.</p>
|
||||
<p>Note that the face object contains several fields used to
|
||||
describe global font data that can be accessed directly by
|
||||
client applications, for example, the total number of
|
||||
glyphs in the face, the face's family name, style name,
|
||||
the EM size for scalable formats, etc. For more details,
|
||||
look at
|
||||
the <a href="../reference/ft2-base_interface.html#FT_FaceRec"><code>FT_FaceRec</code></a>
|
||||
definition in the FreeType 2 API Reference.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
4. The <tt>FT_Size</tt> class
|
||||
</h2>
|
||||
<h3 id="section-4">4. The <tt>FT_Size</tt> class</h3>
|
||||
|
||||
<p>Each <tt>FT_Face</tt> object <em>has</em> one or more
|
||||
<tt>FT_Size</tt> objects. A <em>size object</em> is used to store data
|
||||
specific to a given character width and height. Each newly created face
|
||||
object has one size, which is directly accessible as
|
||||
<tt>face->size</tt>.</p>
|
||||
<p>Each <tt>FT_Face</tt> object has one or more
|
||||
<tt>FT_Size</tt> objects. A <em>size object</em> stores
|
||||
data specific to a given character width and height. Each
|
||||
newly created face object has one size, which is directly
|
||||
accessible as <tt>face->size</tt>.</p>
|
||||
|
||||
<p>The contents of a size object can be changed by calling either
|
||||
<tt>FT_Set_Pixel_Sizes()</tt> or <tt>FT_Set_Char_Size()</tt>.</p>
|
||||
<p>The contents of a size object can be changed by calling
|
||||
<a href="../reference/ft2-base_interface.html#FT_Request_Size"><code>FT_Request_Size</code></a>, <a href="../reference/ft2-base_interface.html#FT_Set_Pixel_Sizes"><code>FT_Set_Pixel_Sizes</code></a>,
|
||||
or <a href="../reference/ft2-base_interface.html#FT_Set_Char_Size"><code>FT_Set_Char_Size</code></a>.</p>
|
||||
|
||||
<p>A new size object can be created with <tt>FT_New_Size()</tt>, and
|
||||
destroyed manually with </tt>FT_Done_Size()</tt>. Note that typical
|
||||
applications don't need to do this normally: they tend to use the
|
||||
default size object provided with each <tt>FT_Face</tt>.</p>
|
||||
<p>A new size object can be created
|
||||
with <a href="../reference/ft2-sizes_management.html#FT_New_Size"><code>FT_New_Size</code></a>,
|
||||
and destroyed manually
|
||||
with <a href="../reference/ft2-sizes_management.html#FT_Done_Size"><code>FT_Done_Size</code></a>.
|
||||
Note that typical applications don't need to do this
|
||||
normally: usually it is fully sufficient to use the
|
||||
default size object provided with
|
||||
each <tt>FT_Face</tt>.</p>
|
||||
|
||||
<p>The public fields of <tt>FT_Size</tt> objects are defined in a very
|
||||
small structure named <tt>FT_SizeRec</tt>. However, it is important to
|
||||
understand that some font drivers define their own derivatives of
|
||||
<tt>FT_Size</tt> to store important internal data that is re-computed
|
||||
each time the character size changes. Most of the time, these are
|
||||
size-specific <em>font hints</em>./p>
|
||||
<p>The public fields of <tt>FT_Size</tt> objects are defined
|
||||
in a very small structure
|
||||
named <a href="../reference/ft2-base_interface.html#FT_SizeRec"><code>FT_SizeRec</code></a>.
|
||||
However, it is important to understand that some font
|
||||
drivers define their own derivatives of <tt>FT_Size</tt>
|
||||
to store important internal data that is re-computed each
|
||||
time the character size changes. Most of the time, these
|
||||
are size-specific <em>font hints</em>.</p>
|
||||
|
||||
<p>For example, the TrueType driver stores the scaled CVT table that
|
||||
results from the execution of the "cvt" program in a <tt>TT_Size</tt>
|
||||
structure, while the Type 1 driver stores scaled global metrics
|
||||
(like blue zones) in a <tt>T1_Size</tt> object. Don't worry if you
|
||||
don't understand the current paragraph; most of this stuff is highly
|
||||
font format specific and doesn't need to be explained to client
|
||||
<p>For example, the TrueType driver stores the scaled CVT
|
||||
(Control Value Table) data that results from the execution
|
||||
of the ‘prep’ program in a <tt>TT_Size</tt>
|
||||
structure, while the Type 1 driver stores scaled
|
||||
global metrics (like blue zones) in a <tt>T1_Size</tt>
|
||||
object. Don't worry if you don't understand the current
|
||||
paragraph; most of this stuff is highly font format
|
||||
specific and doesn't need to be explained to client
|
||||
developers :-)</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
5. The <tt>FT_GlyphSlot</tt> class
|
||||
</h2>
|
||||
<h3 id="section-5">5. The <tt>FT_GlyphSlot</tt> class</h3>
|
||||
|
||||
<p>The purpose of a glyph slot is to provide a place where glyph images
|
||||
can be loaded one by one easily, independently of the glyph image format
|
||||
(bitmap, vector outline, or anything else).</p>
|
||||
<p>The purpose of a <em>glyph slot</em> is to provide a
|
||||
place where glyph images can be loaded one by one easily,
|
||||
independently of the glyph image format (bitmap, vector
|
||||
outline, or anything else).</p>
|
||||
|
||||
<p>Ideally, once a glyph slot is created, any glyph image can be loaded
|
||||
into it without additional memory allocation. In practice, this is only
|
||||
possible with certain formats like TrueType which explicitly provide
|
||||
<p>Ideally, once a glyph slot is created, any glyph image
|
||||
can be loaded into it without additional memory
|
||||
allocation. In practice, this is only possible with
|
||||
certain formats like TrueType which explicitly provide
|
||||
data to compute a slot's maximum size.</p>
|
||||
|
||||
<p>Another reason for glyph slots is that they are also used to hold
|
||||
format-specific hints for a given glyphs as well as all other data
|
||||
necessary to correctly load the glyph.</p>
|
||||
<p>Another reason for glyph slots is that they are also used
|
||||
to hold format-specific hints for a given glyphs as well
|
||||
as all other data necessary to correctly load the
|
||||
glyph.</p>
|
||||
|
||||
<p>The base <tt>FT_GlyphSlotRec</tt> structure only presents glyph
|
||||
metrics and images to client applications, while actual implementation
|
||||
may contain more sophisticated data.</p>
|
||||
<p>The
|
||||
base <a href="../reference/ft2-base_interface.html#FT_GlyphSlotRec"><code>FT_GlyphSlotRec</code></a>
|
||||
structure only presents glyph metrics and images to client
|
||||
applications, while the actual implementation may contain
|
||||
more sophisticated data.</p>
|
||||
|
||||
<p>As an example, the TrueType-specific <tt>TT_GlyphSlotRec</tt>
|
||||
structure contains additional fields to hold glyph-specific bytecode,
|
||||
transient outlines used during the hinting process, and a few other
|
||||
things.
|
||||
<p>As an example, the
|
||||
TrueType-specific <tt>TT_GlyphSlotRec</tt> structure
|
||||
contains additional fields to hold glyph-specific
|
||||
bytecode, transient outlines used during the hinting
|
||||
process, and a few other things. The
|
||||
Type 1-specific <tt>T1_GlyphSlotRec</tt> structure
|
||||
holds glyph hints during glyph loading, as well as
|
||||
additional logic used to properly hint the glyphs when a
|
||||
native Type 1 hinter is used.</p>
|
||||
|
||||
The Type 1-specific <tt>T1_GlyphSlotRec</tt> structure holds glyph
|
||||
hints during glyph loading, as well as additional logic used to properly
|
||||
hint the glyphs when a native Type 1 hinter is used.</p>
|
||||
|
||||
<p>Finally, each face object has a single glyph slot that is directly
|
||||
<p>Each face object has a single glyph slot that is directly
|
||||
accessible as <tt>face->glyph</tt>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
6. The <tt>FT_CharMap</tt> class
|
||||
</h2>
|
||||
<h3 id="section-6">6. The <tt>FT_CharMap</tt> class</h3>
|
||||
|
||||
<p>The <tt>FT_CharMap</tt> type is used as a handle to character map
|
||||
objects, or <em>charmaps</em>. A charmap is simply some sort of table
|
||||
or dictionary which is used to translate character codes in a given
|
||||
encoding into glyph indices for the font.</p>
|
||||
<p>The <tt>FT_CharMap</tt> type is a handle to character map
|
||||
objects, or <em>charmaps</em>. A charmap is simply some
|
||||
sort of table or dictionary to translate character codes
|
||||
in a given encoding into glyph indices for the font.</p>
|
||||
|
||||
<p>A single face may contain several charmaps. Each one of them
|
||||
corresponds to a given character repertoire, like Unicode, Apple Roman,
|
||||
Windows codepages, and other encodings.</p>
|
||||
<p>A single face may contain several charmaps. Each one of
|
||||
them corresponds to a given character repertoire, like
|
||||
Unicode, Apple Roman, Windows codepages, and other
|
||||
encodings.</p>
|
||||
|
||||
<p>Each <tt>FT_CharMap</tt> object contains a "platform" and an
|
||||
"encoding" field used to identify precisely the character repertoire
|
||||
<p>Each <tt>FT_CharMap</tt> object contains a
|
||||
‘platform’ and an ‘encoding’ field
|
||||
to precisely identify the character repertoire
|
||||
corresponding to it.</p>
|
||||
|
||||
<p>Each font format provides its own derivative of
|
||||
<tt>FT_CharMapRec</tt> and thus needs to implement these objects.</p>
|
||||
<a href="../reference/ft2-base_interface.html#FT_CharMapRec"><code>FT_CharMapRec</code></a>
|
||||
and thus needs to implement these objects.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
7. Objects relationships
|
||||
</h2>
|
||||
<h3 id="section-7">7. Objects Relationship</h3>
|
||||
|
||||
<p>The following diagram summarizes what we have just said regarding the
|
||||
public objects managed by the library, as well as explicitly describes
|
||||
their relationships</p>
|
||||
<p>The following diagram summarizes what we have just said
|
||||
regarding the public objects managed by the library; it
|
||||
also describes their relationship.</p>
|
||||
|
||||
<center>
|
||||
<img src="simple-model.png"
|
||||
width=453 height=378
|
||||
width="453"
|
||||
height="378"
|
||||
alt="Simple library model">
|
||||
</center>
|
||||
|
||||
<p>Note that this picture will be updated at the end of the next
|
||||
chapter, related to <em>internal objects</em>.</p>
|
||||
<p>Note that this picture will be updated at the end of the
|
||||
next chapter, related to <em>internal objects</em>.</p>
|
||||
</div>
|
||||
|
||||
<p><hr></p>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-2.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<div class="updated">
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="col2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html#news">News</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../index.html">Overview</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../documentation.html">Documentation</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/developer.html">Development</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/contact.html"
|
||||
class="emphasis">Contact</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- separate primary from secondary entries -->
|
||||
</li>
|
||||
|
||||
<li class="secondary">
|
||||
<a href="index.html">FreeType Design</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-1.html">Introduction</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-2.html">Components and APIs</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-3.html" class="current">Public Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-4.html">Internal Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-5.html">Module Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-6.html">Interfaces and Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div> <!-- id="wrapper" -->
|
||||
|
||||
<div id="TOC-bottom">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,361 +1,406 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Style-Type"
|
||||
content="text/css">
|
||||
<meta http-equiv="Content-Script-Type"
|
||||
content="text/javascript">
|
||||
<meta name="description"
|
||||
content="FreeType Documentation">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
|
||||
<link rel="icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="shortcut icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../css/freetype2_-90.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery-1.11.0.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery.ba-resize.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/freetype2.js">
|
||||
</script>
|
||||
|
||||
<title>FreeType Design / III</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
<body>
|
||||
|
||||
<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>
|
||||
<div id="top"
|
||||
class="bar">
|
||||
<h1><a href="http://freetype.org/index.html">FreeType</a>
|
||||
Design / III</h1>
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-3.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-5.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<div id="wrapper">
|
||||
|
||||
<p><hr></p>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colright">
|
||||
<div class="col1wrap">
|
||||
<div class="col1">
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
III. Internal Objects and Classes
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>Let us have a look now at the <em>internal</em> objects that
|
||||
FreeType 2 uses, i.e., those not directly available to client
|
||||
applications, and see how they fit into the picture.</p>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<h2>
|
||||
1. Memory management
|
||||
</h2>
|
||||
<div id="internal-objects">
|
||||
<h2>III. Internal Objects and Classes</h2>
|
||||
|
||||
<p>All memory management operations are performed through three specific
|
||||
routines of the base layer, namely: <tt>FT_Alloc()</tt>,
|
||||
<tt>FT_Realloc()</tt>, and <tt>FT_Free()</tt>. Each one of these
|
||||
functions expects a <tt>FT_Memory</tt> handle as its first
|
||||
parameter.</p>
|
||||
<p>Let us have a look now at the <em>internal</em> objects
|
||||
that FreeType 2 uses, i.e., those not directly
|
||||
available to client applications, and see how they fit
|
||||
into the picture.</p>
|
||||
|
||||
<p>The latter is a pointer to a simple object used to describe the
|
||||
current memory pool/manager. It contains a simple table of
|
||||
alloc/realloc/free functions. A memory manager is created at library
|
||||
initialization time by <tt>FT_Init_FreeType()</tt>, calling the function
|
||||
<tt>FT_New_Memory()</tt> provided by the <tt>ftsystem</tt>
|
||||
component.</p>
|
||||
|
||||
<p>By default, this manager uses the ANSI <tt>malloc()</tt>,
|
||||
<tt>realloc()</tt>, and <tt>free()</tt> functions. However, as
|
||||
<tt>ftsystem</tt> is a replaceable part of the base layer, a specific
|
||||
build of the library could provide a different default memory
|
||||
manager.</p>
|
||||
<h3 id="section-1">1. Memory Management</h3>
|
||||
|
||||
<p>Even with a default build, client applications are still able to
|
||||
provide their own memory manager by not calling
|
||||
<tt>FT_Init_FreeType()</tt> but follow these simple steps:</p>
|
||||
<p>Most memory management operations are performed through
|
||||
three specific routines of the base
|
||||
layer: <tt>FT_Alloc</tt>, <tt>FT_Realloc</tt>,
|
||||
and <tt>FT_Free</tt>. Each one of these functions expects
|
||||
a <tt>FT_Memory</tt> handle as its first parameter. Note,
|
||||
however, that there exist more, similar variants for
|
||||
specific purposes which we skip here for simplicity.</p>
|
||||
|
||||
<p><tt>FT_Memory</tt> is a pointer to a simple object that
|
||||
describes the current memory pool or manager. It contains
|
||||
a small table of alloc, realloc, and free functions. A
|
||||
memory manager is created at library initialization time
|
||||
by <tt>FT_Init_FreeType</tt>, calling the (internal)
|
||||
function <tt>FT_New_Memory</tt> provided by
|
||||
the <tt>ftsystem</tt> component.</p>
|
||||
|
||||
<p>By default, this manager uses the ANSI functions <tt>malloc</tt>,
|
||||
<tt>realloc</tt>, and <tt>free</tt>. However,
|
||||
as <tt>ftsystem</tt> is a replaceable part of the base
|
||||
layer, a specific build of the library could provide a
|
||||
different default memory manager.</p>
|
||||
|
||||
<p>Even with a default build, client applications are still
|
||||
able to provide their own memory manager by not calling
|
||||
<tt>FT_Init_FreeType</tt> but follow these simple
|
||||
steps.</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<p>Create a new <tt>FT_Memory</tt> object by hand. The definition
|
||||
of <tt>FT_MemoryRec</tt> is located in the public file
|
||||
<tt><freetype/ftsystem.h></tt>.</p>
|
||||
<p>Create a new <tt>FT_Memory</tt> object by hand. The
|
||||
definition
|
||||
of <a href="../reference/ft2-system_interface.html#FT_MemoryRec"><code>FT_MemoryRec</code></a>
|
||||
is located in the public header
|
||||
file <tt>ftsystem.h</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Call <tt>FT_New_Library()</tt> to create a new library instance
|
||||
using your custom memory manager. This new library doesn't yet
|
||||
contain any registered modules.</p>
|
||||
<p>Call <a href="../reference/ft2-module_management.html#FT_New_Library"><code>FT_New_Library</code></a>
|
||||
to create a new library instance using your custom
|
||||
memory manager. This new library doesn't yet contain
|
||||
any registered modules.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Register the set of default modules by calling the function
|
||||
<tt>FT_Add_Default_Modules()</tt> provided by the <tt>ftinit</tt>
|
||||
component, or manually register your drivers by repeatedly
|
||||
calling <tt>FT_Add_Module()</tt>.</p>
|
||||
<p>Register the set of default modules by calling the
|
||||
function <a href="../reference/ft2-module_management.html#FT_Add_Default_Modules"><code>FT_Add_Default_Modules</code></a>
|
||||
provided by the <tt>ftinit</tt> component, or manually
|
||||
register your drivers by repeatedly
|
||||
calling <a href="../reference/ft2-module_management.html#FT_Add_Module"><code>FT_Add_Module</code></a>.</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
2. Input streams
|
||||
</h2>
|
||||
<h3 id="section-2">2. Input Streams</h3>
|
||||
|
||||
<p>Font files are always read through <tt>FT_Stream</tt> objects. The
|
||||
definition of <tt>FT_StreamRec</tt> is located in the public file
|
||||
<tt><freetype/ftsystem.h></tt>, which allows client developers to
|
||||
provide their own implementation of streams if they wish so.</p>
|
||||
<p>Font files are always read through <tt>FT_Stream</tt>
|
||||
objects. The definition
|
||||
of <a href="../reference/ft2-system_interface.html#FT_StreamRec"><code>FT_StreamRec</code></a>
|
||||
is located in the public header file <tt>ftsystem.h</tt>,
|
||||
which allows client developers to provide their own
|
||||
implementation of streams if they wish so.</p>
|
||||
|
||||
<p>The function <tt>FT_New_Face()</tt> will always automatically create
|
||||
a new stream object from the C pathname given as its second
|
||||
argument. This is achieved by calling the function
|
||||
<tt>FT_New_Stream()</tt> provided by the <tt>ftsystem</tt> component.
|
||||
As the latter is replaceable, the implementation of streams may vary
|
||||
greatly between platforms.</p>
|
||||
<p>The
|
||||
function <a href="../reference/ft2-base_interface.html#FT_New_Face"><code>FT_New_Face</code></a>
|
||||
always automatically creates a new stream object from the
|
||||
C pathname given as its second argument. This is
|
||||
achieved by calling the (internal) function
|
||||
<tt>FT_New_Stream</tt> provided by the <tt>ftsystem</tt>
|
||||
component. As the latter is replaceable, the
|
||||
implementation of streams may vary greatly between
|
||||
platforms.</p>
|
||||
|
||||
<p>As an example, the default implementation of streams is located in
|
||||
the file <tt>src/base/ftsystem.c</tt> and uses the ANSI
|
||||
<tt>fopen()</tt>, <tt>fseek()</tt>, and <tt>fread()</tt> calls.
|
||||
However, the Unix build of FreeType 2 provides an alternative
|
||||
implementation that uses memory-mapped files, when available on the host
|
||||
<p>As an example, the default implementation of streams is
|
||||
located in the file <tt>src/base/ftsystem.c</tt> and uses
|
||||
the ANSI functions <tt>fopen</tt>, <tt>fseek</tt>,
|
||||
and <tt>fread</tt>. However, the Unix build of
|
||||
FreeType 2 provides an alternative implementation
|
||||
that uses memory-mapped files, when available on the host
|
||||
platform, resulting in a significant access speed-up.</p>
|
||||
|
||||
<p>FreeType distinguishes between memory-based and disk-based streams.
|
||||
In the first case, all data is directly accessed in memory (e.g.
|
||||
ROM-based, write-only static data and memory-mapped files), while in the
|
||||
second, portions of the font files are read in chunks called
|
||||
<em>frames</em>, and temporarily buffered similarly through typical
|
||||
seek/read operations.</p>
|
||||
<p>FreeType distinguishes between memory-based and
|
||||
disk-based streams. In the first case, all data is
|
||||
directly accessed in memory (e.g., ROM-based, write-only
|
||||
static data, and memory-mapped files), while in the
|
||||
second, portions of the font files are read in chunks
|
||||
called <em>frames</em>, and temporarily buffered similarly
|
||||
through typical seek and read operations.</p>
|
||||
|
||||
<p>The FreeType stream sub-system also implements extremely efficient
|
||||
algorithms to very quickly load structures from font files while
|
||||
ensuring complete safety in the case of a "broken file".</p>
|
||||
<p>The FreeType stream sub-system also implements extremely
|
||||
efficient algorithms to very quickly load structures from
|
||||
font files while ensuring complete safety in the case of a
|
||||
‘broken file’.</p>
|
||||
|
||||
<p>The function <tt>FT_New_Memory_Face()</tt> can be used to directly
|
||||
create/open a <tt>FT_Face</tt> object from data that is readily
|
||||
<p>The
|
||||
function <a href="../reference/ft2-base_interface.html#FT_New_Memory_Face"><code>FT_New_Memory_Face</code></a>
|
||||
can be used to directly create and open
|
||||
an <tt>FT_Face</tt> object from data that is readily
|
||||
available in memory (including ROM-based fonts).</p>
|
||||
|
||||
<p>Finally, in the case where a custom input stream is needed, client
|
||||
applications can use the function <tt>FT_Open_Face()</tt>, which can
|
||||
accept custom input streams. This may be useful in the case of
|
||||
compressed or remote font files, or even embedded font files that need
|
||||
to be extracted from certain documents.</p>
|
||||
<p>Finally, in the case where a custom input stream is
|
||||
needed, client applications can use the
|
||||
function <a href="../reference/ft2-base_interface.html#FT_Open_Face"><code>FT_Open_Face</code></a>,
|
||||
which can accept custom input streams. This may be useful
|
||||
in the case of compressed or remote font files, or even
|
||||
embedded font files that need to be extracted from certain
|
||||
documents.</p>
|
||||
|
||||
<p>Note that each face owns a single stream, which is also destroyed by
|
||||
<tt>FT_Done_Face()</tt>. Generally speaking, it is certainly
|
||||
<em>not</em> a good idea to keep numerous <tt>FT_Face</tt> objects
|
||||
opened.</p>
|
||||
<p>Note that each face owns a single stream, which is also
|
||||
destroyed
|
||||
by <a href="../reference/ft2-base_interface.html#FT_Done_Face"><code>FT_Done_Face</code></a>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
3. Modules
|
||||
</h2>
|
||||
<h3 id="section-3">3. Modules</h3>
|
||||
|
||||
<p>A FreeType 2 module is itself a piece of code. However, the
|
||||
library creates a single <tt>FT_Module</tt> object for each module that
|
||||
is registered when <tt>FT_Add_Module()</tt> is called.</p>
|
||||
<p>A FreeType 2 module is itself a piece of code.
|
||||
However, the library creates a single <tt>FT_Module</tt>
|
||||
object for each module that is registered
|
||||
when <tt>FT_Add_Module</tt> is called.</p>
|
||||
|
||||
<p>The definition of <tt>FT_ModuleRec</tt> is not publicly available to
|
||||
client applications. However, each <em>module type</em> is described by
|
||||
a simple public structure named <tt>FT_Module_Class</tt>, defined in
|
||||
<tt><freetype/ftmodule.h></tt>, and is described later in this
|
||||
document:</p>
|
||||
<p>The definition of <tt>FT_ModuleRec</tt> is not publicly
|
||||
available to client applications. However,
|
||||
each <em>module type</em> is described by a simple public
|
||||
structure
|
||||
named <a href="../reference/ft2-module_management.html#FT_Module_Class"><code>FT_Module_Class</code></a>,
|
||||
defined in header file
|
||||
<tt>ftmodule.h</tt>, and is described later in this
|
||||
document.</p>
|
||||
|
||||
<p>You need a pointer to an <tt>FT_Module_Class</tt> structure when
|
||||
calling <tt>FT_Add_Module()</tt>, whose declaration is:</p>
|
||||
<p>You need a pointer to an <tt>FT_Module_Class</tt>
|
||||
structure when
|
||||
calling <a href="../reference/ft2-module_management.html#FT_Add_Module"><code>FT_Add_Module</code></a>.</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
FT_Error FT_Add_Module( FT_Library library,
|
||||
<pre>
|
||||
FT_Error
|
||||
FT_Add_Module( FT_Library library,
|
||||
const FT_Module_Class* clazz );</pre>
|
||||
</font>
|
||||
|
||||
<p>Calling this function will do the following:</p>
|
||||
<p>This function does the following tasks.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>It will check whether the library already holds a module object
|
||||
corresponding to the same module name as the one found in
|
||||
<tt>FT_Module_Class</tt>.</p>
|
||||
<p>Check whether the library already holds a module
|
||||
object corresponding to the same module name as the
|
||||
one found in <tt>FT_Module_Class</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If this is the case, it will compare the module version number to
|
||||
see whether it is possible to <em>upgrade</em> the module to a new
|
||||
version. If the module class's version number is smaller than the
|
||||
already installed one, the function returns immediately. Similarly,
|
||||
it checks that the version of FreeType 2 that is running is
|
||||
correct compared to the one required by the module.</p>
|
||||
<p>If this is the case, compare the module version
|
||||
number to see whether it is possible
|
||||
to <em>upgrade</em> the module to a new version. If
|
||||
the module class's version number is smaller than the
|
||||
already installed one, return immediately. Similarly,
|
||||
check that the version of FreeType 2 that is
|
||||
running is correct compared to the one required by the
|
||||
module.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>It creates a new <tt>FT_Module</tt> object, using data and flags
|
||||
of the module class to determine its byte size and how to properly
|
||||
initialize it.</p>
|
||||
<p>Create a new <tt>FT_Module</tt> object, using data
|
||||
and flags of the module class to determine its byte
|
||||
size and how to properly initialize it.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If a module initializer is present in the module class, it will
|
||||
be called to complete the module object's initialization.</p>
|
||||
<p>If a module initializer is present in the module
|
||||
class, call it to complete the module object's
|
||||
initialization.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The new module is added to the library's list of "registered"
|
||||
modules. In case of an upgrade, the previous module object is
|
||||
simply destroyed.</p>
|
||||
<p>Add the new module to the library's list of
|
||||
‘registered’ modules. In case of an
|
||||
upgrade, destroy the previous module object.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Note that this function doesn't return an <tt>FT_Module</tt> handle,
|
||||
given that module objects are completely internal to the library (and
|
||||
client applications shouldn't normally mess with them :-)</p>
|
||||
<p>Note that this function doesn't return
|
||||
an <tt>FT_Module</tt> handle, given that module objects
|
||||
are completely internal to the library (and client
|
||||
applications shouldn't normally mess with
|
||||
them :-)</p>
|
||||
|
||||
<p>Finally, it is important to understand that FreeType 2
|
||||
recognizes and manages several kinds of modules. These will be
|
||||
explained in more details later in this document, but we will list for
|
||||
now the following types:</p>
|
||||
<p>Finally, it is important to understand that
|
||||
FreeType 2 recognizes and manages several kinds of
|
||||
modules. These will be explained later on in this
|
||||
document.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><em>Renderer</em> modules are used to convert native glyph images
|
||||
to bitmaps/pixmaps. FreeType 2 comes with two renderer modules
|
||||
by default: one to generate monochrome bitmaps, the other to
|
||||
generate high-quality anti-aliased pixmaps.</p>
|
||||
<p><em>Renderer</em> modules are used to convert native
|
||||
glyph images to bitmaps or pixmaps. FreeType 2
|
||||
comes with two renderer modules by default: one to
|
||||
generate monochrome bitmaps, the other to generate
|
||||
anti-aliased pixmaps.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Font driver</em> modules are used to support one or more font
|
||||
formats. Typically, each font driver provides a specific
|
||||
implementation/derivative of <tt>FT_Face</tt>, <tt>FT_Size</tt>,
|
||||
<tt>FT_GlyphSlot</tt>, as well as <tt>FT_CharMap</tt>.</p>
|
||||
<p><em>Font driver</em> modules are used to support one
|
||||
or more font formats. Typically, each font driver
|
||||
provides a specific implementation or derivative
|
||||
of <tt>FT_Face</tt>, <tt>FT_Size</tt>,
|
||||
<tt>FT_GlyphSlot</tt>, as well
|
||||
as <tt>FT_CharMap</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>Helper</em> modules are shared by several font drivers. For
|
||||
example, the <tt>sfnt</tt> module parses and manages tables found in
|
||||
SFNT-based font formats; it is then used by both the TrueType and
|
||||
OpenType font drivers.</p>
|
||||
<p><em>Helper</em> modules are shared by several font
|
||||
drivers. For example, the <tt>sfnt</tt> module parses
|
||||
and manages tables found in SFNT-based font formats;
|
||||
it is then used by both the TrueType font and CFF
|
||||
drivers.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Finally, the <em>auto-hinter</em> module has a specific place in
|
||||
the library's design, as its role is to process vectorial glyph
|
||||
outlines, independently of their native font format, to produce
|
||||
optimal results at small pixel sizes.</p>
|
||||
<p>Finally, the <em>auto-hinter</em> module has a
|
||||
specific place in the library's design, as its role is
|
||||
to process vectorial glyph outlines, independently of
|
||||
their native font format, to produce optimal results
|
||||
at small pixel sizes.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Note that every <tt>FT_Face</tt> object is <em>owned</em> by the
|
||||
corresponding font driver, depending on the original font file's format.
|
||||
This means that all face objects are destroyed when a module is
|
||||
removed/unregistered from a library instance (typically by calling the
|
||||
<tt>FT_Remove_Module()</tt> function).</p>
|
||||
<p>Note that every <tt>FT_Face</tt> object is <em>owned</em>
|
||||
by the corresponding font driver, depending on the
|
||||
original font file's format. This means that all face
|
||||
objects are destroyed when a module is removed or
|
||||
unregistered from a library instance (typically by calling
|
||||
the <a href="../reference/ft2-module_management.html#FT_Remove_Module"><code>FT_Remove_Module</code></a>
|
||||
function). Because of this, you should always take care
|
||||
that no <tt>FT_Face</tt> object is opened when you upgrade
|
||||
or remove a module from a library, as this could cause
|
||||
unexpected object deletion!</p>
|
||||
|
||||
<p><em>Because of this, you should always take care that no
|
||||
<tt>FT_Face</tt> object is opened when you upgrade or remove a module
|
||||
from a library, as this could cause unexpected object deletion!</em></p>
|
||||
|
||||
<hr>
|
||||
<h3 id="section-4">4. Summary</h3>
|
||||
|
||||
<h2>
|
||||
4. Libraries
|
||||
</h2>
|
||||
|
||||
<p>We now come back to our well-known <tt>FT_Library</tt> object. From
|
||||
what have been said before, we already know that a library instance owns
|
||||
at least the following:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>A memory manager object (<tt>FT_Memory</tt>), used for all
|
||||
allocation/releases within the instance.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A list of <tt>FT_Module</tt> objects, corresponding to the
|
||||
"installed" or "registered" modules of the instance. This list can
|
||||
be changed at any time through <tt>FT_Add_Module()</tt> and
|
||||
<tt>FT_Remove_Module()</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Remember that face objects are owned by font drivers that are
|
||||
themselves modules owned by the library.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>There is however another object owned by the library instance that
|
||||
hasn't been described yet: the <em>raster pool</em>.</p>
|
||||
|
||||
<p>The <em>raster pool</em> is simply a block of memory of fixed size
|
||||
that is used internally as a "scratch area" for various memory-hungry
|
||||
transient operations, avoiding memory allocation. For example, it is
|
||||
used by each renderer when converting a vectorial glyph outline into a
|
||||
bitmap (actually, that's where its name comes from :-).</p>
|
||||
|
||||
<p>The size of the raster pool is fixed at initialisation time (it
|
||||
defaults to 16kByte) and cannot be changed at run-time (though we could
|
||||
fix this if there is a real need for that).</p>
|
||||
|
||||
<p>When a transient operation needs more memory than the pool's size, it
|
||||
can decide to either allocate a heap block as an exceptional condition,
|
||||
or sub-divide recursively the task to perform in order to never exceed
|
||||
the pool's threshold.</p>
|
||||
|
||||
<p>This extremely memory-conservative behaviour is certainly one of the
|
||||
keys to FreeType's performance in certain areas (most importantly in
|
||||
glyph rendering/scanline-conversion).</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>
|
||||
5. Summary
|
||||
</h2>
|
||||
|
||||
<p>Finally, the following picture illustrates what has been said in this
|
||||
section, as well as the previous, by presenting the complete object
|
||||
graph of FreeType 2's base design:</p>
|
||||
<p>Finally, the following picture illustrates what has been
|
||||
said in this section, as well as the previous, by
|
||||
presenting the complete object graph of FreeType 2's
|
||||
base design.</p>
|
||||
|
||||
<center>
|
||||
<img src="library-model.png"
|
||||
width=411 height=405
|
||||
width="411"
|
||||
height="405"
|
||||
alt="Complete library model">
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<p><hr></p>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-3.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-5.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<div class="updated">
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="col2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html#news">News</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../index.html">Overview</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../documentation.html">Documentation</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/developer.html">Development</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/contact.html"
|
||||
class="emphasis">Contact</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- separate primary from secondary entries -->
|
||||
</li>
|
||||
|
||||
<li class="secondary">
|
||||
<a href="index.html">FreeType Design</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-1.html">Introduction</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-2.html">Components and APIs</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-3.html">Public Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-4.html" class="current">Internal Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-5.html">Module Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-6.html">Interfaces and Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div> <!-- id="wrapper" -->
|
||||
|
||||
<div id="TOC-bottom">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,250 +1,245 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Style-Type"
|
||||
content="text/css">
|
||||
<meta http-equiv="Content-Script-Type"
|
||||
content="text/javascript">
|
||||
<meta name="description"
|
||||
content="FreeType Documentation">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
|
||||
<link rel="icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="shortcut icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../css/freetype2_-90.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery-1.11.0.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery.ba-resize.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/freetype2.js">
|
||||
</script>
|
||||
|
||||
<title>FreeType Design / IV</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
<body>
|
||||
|
||||
<h3 align=center>
|
||||
Copyright 1998-2000 David Turner (<a
|
||||
href="mailto:david@freetype.org">david@freetype.org</a>)<br>
|
||||
Copyright 2000, 2007 The FreeType Development Team (<a
|
||||
href="mailto:devel@freetype.org">devel@freetype.org</a>)
|
||||
</h3>
|
||||
<div id="top"
|
||||
class="bar">
|
||||
<h1><a href="http://freetype.org/index.html">FreeType</a>
|
||||
Design / IV</h1>
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-6.html">Next</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<div id="wrapper">
|
||||
|
||||
<p><hr></p>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colright">
|
||||
<div class="col1wrap">
|
||||
<div class="col1">
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
IV. Module Classes
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p>We will now try to explain more precisely the <em>types</em> of modules
|
||||
that FreeType 2 is capable of managing. Note that each one of them
|
||||
is described with more details in the following chapters of this
|
||||
document.</p>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="module-classes">
|
||||
<h2>IV. Module Classes</h2>
|
||||
|
||||
<p>We will now try to explain more precisely
|
||||
the <em>types</em> of modules that FreeType 2 is
|
||||
capable of managing.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><em>Renderer</em> modules are used to manage scalable glyph images.
|
||||
This means <em>transforming</em> them, computing their <em>bounding
|
||||
box</em>, and <em>converting</em> them to either <em>monochrome</em>
|
||||
or <em>anti-aliased</em> bitmaps</em>.</p>
|
||||
<p><em>Renderer</em> modules manage scalable glyph
|
||||
images. This means <em>transforming</em> them,
|
||||
computing their <em>bounding box</em>,
|
||||
and <em>converting</em> them to
|
||||
either <em>monochrome</em> or <em>anti-aliased</em>
|
||||
bitmaps.</p>
|
||||
|
||||
<p>Note that FreeType 2 is capable of dealing with <em>any</em>
|
||||
kind of glyph images, as long as a renderer module is provided for it.
|
||||
The library comes by default with two renderers:</p>
|
||||
<p>Note that FreeType 2 is capable of dealing
|
||||
with <em>any</em> kind of glyph images, as long as a
|
||||
renderer module is provided for it. The library comes
|
||||
by default with two renderers.</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<table>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>raster</tt>
|
||||
<p><tt>raster</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Supports the conversion of vectorial outlines (described by a
|
||||
<tt>FT_Outline</tt> object) to <em>monochrome</em> bitmaps.
|
||||
<p>Supports the conversion of vectorial outlines
|
||||
(described by
|
||||
an <a href="../reference/ft2-outline_processing.html#FT_Outline"><code>FT_Outline</code></a>
|
||||
object) to <em>monochrome</em> bitmaps.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>smooth</tt>
|
||||
<p><tt>smooth</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Supports the conversion of the same outlines to high-quality
|
||||
<em>anti-aliased</em> pixmaps (using 256 levels of gray). Note
|
||||
that this renderer also supports direct span generation.</p>
|
||||
<p>Supports the conversion of the same outlines to
|
||||
<em>anti-aliased</em> pixmaps (using 256 levels of
|
||||
gray). Note that this renderer also supports
|
||||
direct span generation, this is, it provides a
|
||||
hook into the engine so that the application can
|
||||
manipulate the rendering results itself, instead
|
||||
of letting the rasterizer fill a pixmap.
|
||||
See <a href="../tutorial/example4.cpp">this
|
||||
tutorial demo file</a> for an example.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
<li>
|
||||
<p><em>Font driver</em> modules are used to support one or more
|
||||
specific font format. By default, FreeType 2 comes with the
|
||||
following font drivers:</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>truetype</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports TrueType font files</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>type1</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports Postscript Type 1 fonts, both in binary
|
||||
(<tt>.pfb</tt>) or ASCII (<tt>.pfa</tt>) formats, including
|
||||
Multiple Master fonts.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>cid</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports Postscript CID-keyed fonts</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>cff</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports OpenType, CFF as well as CEF fonts (CEF is a
|
||||
derivative of CFF used by Adobe in its SVG viewer)</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>winfonts</tt>
|
||||
</td>
|
||||
<td>
|
||||
<p>supports Windows bitmap fonts (i.e. <tt>.fon</tt> and
|
||||
<tt>.fnt</tt>)</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
<p>Note that font drivers can support bitmapped or scalable glyph
|
||||
images. A given font driver that supports Bézier outlines
|
||||
through <tt>FT_Outline</tt> can also provide its own hinter, or rely
|
||||
on FreeType's <tt>autohinter</tt> module.</p>
|
||||
</table>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><em>Helper</em> modules are used to hold shared code that is often
|
||||
used by several font drivers, or even other modules. Here are the
|
||||
default helpers:</p>
|
||||
<p><em>Font driver</em> modules support one or more
|
||||
specific font formats. Here is a list with the most
|
||||
important ones.</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<table>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>sfnt</tt>
|
||||
<p><tt>truetype</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
used to support font formats based on the <tt>SFNT</tt> storage
|
||||
scheme: TrueType & OpenType fonts as well as other variants (like
|
||||
TrueType fonts that only contain embedded bitmaps)
|
||||
<p>TrueType fonts.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>psnames</tt>
|
||||
<p><tt>type1</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
used to provide various useful functions related to glyph names
|
||||
ordering and Postscript encodings/charsets. For example, this
|
||||
module is capable of automatically synthetizing a Unicode charmap
|
||||
from a Type 1 glyph name dictionary.
|
||||
<p>Postscript Type 1 fonts, both in binary
|
||||
(<tt>.pfb</tt>) or ASCII (<tt>.pfa</tt>)
|
||||
formats, including Multiple Master fonts.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>psaux</tt>
|
||||
<p><tt>cid</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
used to provide various useful functions related to Type 1
|
||||
charstring decoding, as this "feature" is needed by the
|
||||
<tt>type1</tt>, <tt>cid</tt>, and <tt>cff</tt> drivers.
|
||||
<p>Postscript CID-keyed fonts.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<p><tt>cff</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>OpenType CFF and CFF2, bare CFF, and CEF fonts
|
||||
(CEF is a derivative of CFF used by Adobe in its
|
||||
SVG viewer).</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<p><tt>winfonts</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Windows bitmap fonts (i.e., <tt>.fon</tt> and
|
||||
<tt>.fnt</tt>).</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>Note that font drivers can support bitmapped or
|
||||
scalable glyph images. A given font driver that
|
||||
supports Bézier outlines
|
||||
through <tt>FT_Outline</tt> can also provide its own
|
||||
hinter, or rely on FreeType's <tt>autofit</tt>
|
||||
module for auto-hinting.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Finally, the <em>autohinter</em> module has a specific role in
|
||||
FreeType 2, as it can be used automatically during glyph loading
|
||||
to process individual glyph outlines when a font driver doesn't
|
||||
provide its own hinting engine.</p>
|
||||
<p><em>Helper</em> modules are used to hold shared code
|
||||
that is often used by several font drivers, or even
|
||||
other modules. The most important are as follows.</p>
|
||||
|
||||
<p>This module's purpose and design is also heavily described on the
|
||||
FreeType web site.</p>
|
||||
<table>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<p><tt>sfnt</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Support for font formats based on
|
||||
the <tt>SFNT</tt> storage scheme: TrueType,
|
||||
OpenType, as well as other variants (like
|
||||
TrueType fonts that only contain embedded
|
||||
bitmaps).</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<p><tt>psnames</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Various useful functions related to glyph name
|
||||
ordering and Postscript encodings and charsets.
|
||||
For example, this module is capable of
|
||||
automatically synthetizing a Unicode charmap
|
||||
from a Type 1 glyph name dictionary.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<p><tt>psaux</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Auxiliary functions related to Postscript
|
||||
charstring decoding, as needed by
|
||||
the <tt>type1</tt>, <tt>cid</tt>,
|
||||
and <tt>cff</tt> drivers.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<li>
|
||||
<p>Finally, the <em>auto-hinter</em> module
|
||||
(<tt>autofit</tt>) has a specific role in
|
||||
FreeType 2, as it can be used automatically
|
||||
during glyph loading to process individual glyph
|
||||
outlines when a font driver doesn't provide its own
|
||||
hinting engine.</p>
|
||||
|
||||
<p>A paper published in the EuroTeX 2003 proceedings,
|
||||
titled <a href="http://www.tug.org/TUGboat/tb24-3/lemberg.pdf"><em>Real-Time
|
||||
Grid Fitting of Typographic Outlines</em></a>, gives
|
||||
further insight into the auto-hinting system's inner
|
||||
workings.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>We will now study how modules are described, then managed by the
|
||||
library.</p>
|
||||
<p>We will now study how modules are described, then managed
|
||||
by the library.</p>
|
||||
|
||||
<h3>
|
||||
1. The <tt>FT_Module_Class</tt> structure
|
||||
</h3>
|
||||
|
||||
<p>As described later in this document, library initialization is
|
||||
performed by calling the <tt>FT_Init_FreeType()</tt> function. The
|
||||
latter is in charge of creating a new "empty" <tt>FT_Library</tt>
|
||||
object, then register each "default" module by repeatedly calling the
|
||||
<tt>FT_Add_Module()</tt> function.</p>
|
||||
<h3 id="section-1">1. The <tt>FT_Module_Class</tt>
|
||||
Structure</h3>
|
||||
|
||||
<p>Similarly, client applications can call <tt>FT_Add_Module()</tt> any
|
||||
time they wish in order to register a new module in the library. Let us
|
||||
take a look at this function's declaration:</p>
|
||||
<p>Here is the definition of <tt>FT_Module_Class</tt>, with
|
||||
some explanations. The following code is taken from
|
||||
<tt>ftmodapi.h</tt>.</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
extern FT_Error FT_Add_Module(
|
||||
FT_Library library,
|
||||
const FT_Module_Class* clazz );</pre>
|
||||
</font>
|
||||
|
||||
<p>As one can see, this function expects a handle to a library object,
|
||||
as well as a pointer to a <tt>FT_Module_Class</tt> structure. It
|
||||
returns an error code. In case of success, a new module object is
|
||||
created and added to the library. Note by the way that the module isn't
|
||||
returned directly by the call!</p>
|
||||
|
||||
<p>Here is the definition of <tt>FT_Module_Class</tt>, with some
|
||||
explanations. The following code is taken from
|
||||
<tt><freetype/ftmodule.h></tt>:</p>
|
||||
|
||||
<font color="blue"><pre>
|
||||
typedef struct FT_Module_Class_
|
||||
{
|
||||
<pre>
|
||||
typedef struct FT_Module_Class_
|
||||
{
|
||||
FT_ULong module_flags;
|
||||
FT_Int module_size;
|
||||
const FT_String* module_name;
|
||||
@ -257,202 +252,297 @@
|
||||
FT_Module_Destructor module_done;
|
||||
FT_Module_Requester get_interface;
|
||||
|
||||
} FT_Module_Class;</pre>
|
||||
</font>
|
||||
} FT_Module_Class;</pre>
|
||||
|
||||
<p>A description of its fields:</p>
|
||||
<p>A description of its fields.</p>
|
||||
|
||||
<p><table cellpadding=8>
|
||||
<table>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_flags</tt>
|
||||
<p><tt>module_flags</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>A set of bit flags used to describe the module's category. Valid
|
||||
values are:</p>
|
||||
<p>A set of bit flags to describe the module's
|
||||
category. Valid values are listed below.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<tt>ft_module_font_driver</tt> if the module is a font driver
|
||||
<tt>FT_MODULE_FONT_DRIVER</tt> if the module is a
|
||||
font driver
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_renderer</tt> if the module is a renderer
|
||||
<tt>FT_MODULE_RENDERER</tt> if the module is a
|
||||
renderer
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_hinter</tt> if the module is an auto-hinter
|
||||
<tt>FT_MODULE_HINTER</tt> if the module is an
|
||||
auto-hinter
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_driver_scalable</tt> if the module is a font
|
||||
driver supporting scalable glyph formats
|
||||
<tt>FT_MODULE_DRIVER_SCALABLE</tt> if the module
|
||||
is a font driver supporting scalable glyph formats
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_driver_no_outlines</tt> if the module is a font
|
||||
driver supporting scalable glyph formats that <em>cannot</em> be
|
||||
described by an <tt>FT_Outline</tt> object
|
||||
<tt>FT_MODULE_DRIVER_NO_OUTLINES</tt> if the
|
||||
module is a font driver supporting scalable glyph
|
||||
formats that <em>cannot</em> be described by
|
||||
an <tt>FT_Outline</tt> object
|
||||
</li>
|
||||
<li>
|
||||
<tt>ft_module_driver_has_hinter</tt> if the module is a font
|
||||
driver that provides its own hinting scheme/algorithm
|
||||
<tt>FT_MODULE_DRIVER_HAS_HINTER</tt> if the module
|
||||
is a font driver that provides its own hinting
|
||||
scheme/algorithm
|
||||
</li>
|
||||
<li>
|
||||
<tt>FT_MODULE_DRIVER_HINTS_LIGHTLY</tt> if the
|
||||
module is a font driver that generates
|
||||
‘light’ hints (this is, only along the
|
||||
vertical axis).
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_size</tt>
|
||||
<p><tt>module_size</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>An integer that gives the size in <em>bytes</em> of a given
|
||||
module object. This should <em>never</em> be less than
|
||||
<tt>sizeof(FT_ModuleRec)</tt>, but can be more if the module needs
|
||||
to sub-class the base <tt>FT_ModuleRec</tt> class.</p>
|
||||
<p>An integer that gives the size in <em>bytes</em> of
|
||||
a given module object. This should <em>never</em>
|
||||
be less than <tt>sizeof(FT_ModuleRec)</tt>, but can
|
||||
be more if the module needs to sub-class the
|
||||
base <tt>FT_ModuleRec</tt> class.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_name</tt>
|
||||
<p><tt>module_name</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>The module's internal name, coded as a simple ASCII
|
||||
C string. There can't be two modules with the same name
|
||||
registered in a given <tt>FT_Library</tt> object. However,
|
||||
<tt>FT_Add_Module()</tt> uses the <tt>module_version</tt> field to
|
||||
detect module upgrades and perform them cleanly, even at
|
||||
C string. There can't be two modules with the
|
||||
same name registered in a given <tt>FT_Library</tt>
|
||||
object. However, <tt>FT_Add_Module</tt> uses
|
||||
the <tt>module_version</tt> field to detect module
|
||||
upgrades and perform them cleanly, even at
|
||||
run-time.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_version</tt>
|
||||
<p><tt>module_version</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>A 16.16 fixed-point number giving the module's major and minor
|
||||
version numbers. It is used to determine whether a module needs to
|
||||
be upgraded when calling <tt>FT_Add_Module()</tt>.</p>
|
||||
<p>A 16.16 fixed-point number giving the module's
|
||||
major and minor version numbers. It is used to
|
||||
determine whether a module needs to be upgraded when
|
||||
calling <tt>FT_Add_Module</tt>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_requires</tt>
|
||||
<p><tt>module_requires</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>A 16.16 fixed-point number giving the version of FreeType 2
|
||||
that is required to install this module. The default value is
|
||||
0x20000 for FreeType version 2.0</p>
|
||||
<p>A 16.16 fixed-point number giving the version of
|
||||
FreeType 2 that is required to install this
|
||||
module. The default value is 0x20000 for FreeType
|
||||
version 2.x</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_interface</tt>
|
||||
<p><tt>module_interface</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Most modules support one or more "interfaces", i.e. tables of
|
||||
function pointers. This field is used to point to the module's main
|
||||
interface, if there is one. It is a short-cut that prevents users
|
||||
of the module to call "get_interface()" each time they need to
|
||||
<p>Most modules support one or more
|
||||
‘interfaces’, i.e., tables of function
|
||||
pointers. This field points to the module's main
|
||||
interface, if there is one. It is a short-cut that
|
||||
prevents users of the module to
|
||||
call <tt>get_interface</tt> each time they need to
|
||||
access one of the object's common entry points.</p>
|
||||
|
||||
<p>Note that it is optional, and can be set to NULL. Other
|
||||
interfaces can also be accessed through the <tt>get_interface()</tt>
|
||||
field.</p>
|
||||
<p>Note that it is optional, and can be set to NULL.
|
||||
Other interfaces can also be accessed through
|
||||
the <tt>get_interface</tt> field.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_init</tt>
|
||||
<p><tt>module_init</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>A pointer to a function used to initialize the fields of a fresh
|
||||
new <tt>FT_Module</tt> object. It is called <em>after</em> the
|
||||
module's base fields have been set by the library, and is generally
|
||||
used to initialize the fields of <tt>FT_ModuleRec</tt>
|
||||
<p>A pointer to a function to initialize the fields of
|
||||
a fresh new <tt>FT_Module</tt> object. It is
|
||||
called <em>after</em> the module's base fields have
|
||||
been set by the library, and is generally used to
|
||||
initialize the fields of <tt>FT_ModuleRec</tt>
|
||||
subclasses.</p>
|
||||
|
||||
<p>Most module classes set it to NULL to indicate that no extra
|
||||
initialization is necessary.</p>
|
||||
<p>Most module classes set it to NULL to indicate that
|
||||
no extra initialization is necessary.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>module_done</tt>
|
||||
<p><tt>module_done</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>A pointer to a function used to finalize the fields of a given
|
||||
<tt>FT_Module</tt> object. Note that it is called <em>before</em>
|
||||
the library unsets the module's base fields, and is generally used
|
||||
to finalize the fields of <tt>FT_ModuleRec</tt> subclasses.</p>
|
||||
<p>A pointer to a function to finalize the fields of a
|
||||
given <tt>FT_Module</tt> object. Note that it is
|
||||
called <em>before</em> the library unsets the
|
||||
module's base fields, and is generally used to
|
||||
finalize the fields of <tt>FT_ModuleRec</tt>
|
||||
subclasses.</p>
|
||||
|
||||
<p>Most module classes set it to NULL to indicate that no extra
|
||||
finalization is necessary</p>
|
||||
<p>Most module classes set it to NULL to indicate that
|
||||
no extra finalization is necessary</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td>
|
||||
<tt>get_interface</tt>
|
||||
<p><tt>get_interface</tt></p>
|
||||
</td>
|
||||
<td>
|
||||
<p>A pointer to a function used to request the address of a given
|
||||
module interface. Set it to NULL if you don't need to support
|
||||
additional interfaces but the main one.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
|
||||
<h3>
|
||||
2. The <tt>FT_Module</tt> type
|
||||
</h3>
|
||||
|
||||
<p>The <tt>FT_Module</tt> type is a handle (i.e. a pointer) to a given
|
||||
module object/instance, whose base structure is given by the internal
|
||||
<tt>FT_ModuleRec</tt> type. We will intentionally <em>not</em> describe
|
||||
this structure here, as there is no point to look so far into the
|
||||
library's design.</p>
|
||||
|
||||
<p>When <tt>FT_Add_Module</tt> is called, it first allocates a new
|
||||
module instance, using the <tt>module_size</tt> class field to determine
|
||||
its byte size. The function initializes the root <tt>FT_ModuleRec</tt>
|
||||
field, then calls the class-specific initializer <tt>module_init</tt>
|
||||
when this field is not set to NULL.</p>
|
||||
|
||||
<p>Note that the library defines several sub-classes of
|
||||
<tt>FT_ModuleRec</tt>, which are, as you could have guessed:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><tt>FT_Renderer</tt> for renderer modules</p>
|
||||
<li><p><tt>FT_Driver</tt> for font driver modules</p>
|
||||
<li><p><tt>FT_AutoHinter</tt> for the auto-hinter</p>
|
||||
</ul>
|
||||
|
||||
<p>Helper modules use the base <tt>FT_ModuleRec</tt> type. We will
|
||||
describe these classes in the next chapters.</p>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-4.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-6.html">Next</a>
|
||||
<p>A pointer to a function to request the address of a
|
||||
given module interface. Set it to NULL if you don't
|
||||
need to support additional interfaces but the main
|
||||
one.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<h3 id="section-2">2. The <tt>FT_Module</tt> Type</h3>
|
||||
|
||||
<p>The <tt>FT_Module</tt> type is a handle (i.e., a pointer)
|
||||
to a given module object or instance, whose base structure
|
||||
is given by the internal <tt>FT_ModuleRec</tt> type. We
|
||||
will intentionally <em>not</em> describe this structure
|
||||
here, as there is no point to look so far into the
|
||||
library's design.</p>
|
||||
|
||||
<p>When <tt>FT_Add_Module</tt> is called, it first allocates
|
||||
a new module instance, using the <tt>module_size</tt>
|
||||
class field to determine its byte size. The function
|
||||
initializes the root <tt>FT_ModuleRec</tt> field, then
|
||||
calls the class-specific initializer <tt>module_init</tt>
|
||||
when this field is not set to NULL.</p>
|
||||
|
||||
<p>Note that the library defines several sub-classes of
|
||||
<tt>FT_ModuleRec</tt>.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><tt>FT_Renderer</tt> for renderer modules</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><tt>FT_Driver</tt> for font driver modules</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><tt>FT_AutoHinter</tt> for the auto-hinter</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Helper modules use the base <tt>FT_ModuleRec</tt>
|
||||
type.</p>
|
||||
</div>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="col2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html#news">News</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../index.html">Overview</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../documentation.html">Documentation</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/developer.html">Development</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/contact.html"
|
||||
class="emphasis">Contact</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- separate primary from secondary entries -->
|
||||
</li>
|
||||
|
||||
<li class="secondary">
|
||||
<a href="index.html">FreeType Design</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-1.html">Introduction</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-2.html">Components and APIs</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-3.html">Public Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-4.html">Internal Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-5.html" class="current">Module Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-6.html">Interfaces and Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div> <!-- id="wrapper" -->
|
||||
|
||||
<div id="TOC-bottom">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,94 +1,415 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Style-Type"
|
||||
content="text/css">
|
||||
<meta http-equiv="Content-Script-Type"
|
||||
content="text/javascript">
|
||||
<meta name="description"
|
||||
content="FreeType Documentation">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
|
||||
<link rel="icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="shortcut icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../css/freetype2_-90.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery-1.11.0.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery.ba-resize.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/freetype2.js">
|
||||
</script>
|
||||
|
||||
<title>FreeType Design / V</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
<body>
|
||||
|
||||
<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>
|
||||
|
||||
<center>
|
||||
<table width="65%">
|
||||
<tr><td>
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC"
|
||||
valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="design-5.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p><hr></p>
|
||||
|
||||
<table width="100%">
|
||||
<tr bgcolor="#ccccee"><td>
|
||||
<h1>
|
||||
TO BE CONTINUED...
|
||||
</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
<div id="top"
|
||||
class="bar">
|
||||
<h1><a href="http://freetype.org/index.html">FreeType</a>
|
||||
Design / V</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<p><hr></p>
|
||||
<div id="wrapper">
|
||||
|
||||
<center>
|
||||
<table width="100%"
|
||||
border=0
|
||||
cellpadding=5>
|
||||
<tr bgcolor="#CCFFCC" valign=center>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href=design-5.html">Previous</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
<a href="index.html">Contents</a>
|
||||
</td>
|
||||
<td align=center
|
||||
width="30%">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colright">
|
||||
<div class="col1wrap">
|
||||
<div class="col1">
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="module-classes">
|
||||
<h2>V. Interfaces and Services</h2>
|
||||
|
||||
<p>We shall now go into detail about interfaces and services
|
||||
in FreeType.</p>
|
||||
|
||||
<p><em>Interfaces</em> in FreeType are analogous to those
|
||||
found in object-oriented programming. They can be thought
|
||||
of as internal public APIs, and are essentially tables of
|
||||
function pointers.</p>
|
||||
|
||||
<p>Interfaces only describe the form and functionality, but
|
||||
the actual function body may be implemented elsewhere.
|
||||
The module that is implementing the interface will then
|
||||
pass the required function pointers to the table. This
|
||||
gives modularity and easy extendability.</p>
|
||||
|
||||
<p>There are two main kinds of interfaces: <em>module</em>
|
||||
interfaces, and <em>services</em>.</p>
|
||||
|
||||
<p>Module interfaces are defined for each module. For
|
||||
example, every font driver provides its own set of
|
||||
procedures for use in the base layer, which are registered
|
||||
in an <tt>FT_Driver</tt>. This way, very different font
|
||||
drivers can be used in the same way in the base layer.</p>
|
||||
|
||||
<p>Services are cross-module interfaces. These provide
|
||||
functionality needed in several font drivers. </p>
|
||||
|
||||
<p>Services are created when code from one module needs to
|
||||
be used in another. Rather than include files from
|
||||
another module, a service is created instead. Now, the
|
||||
other module just needs to include the header defining the
|
||||
interface.</p>
|
||||
|
||||
<p>Helper modules are an extreme example of this; all their
|
||||
public functionality is made for use in other font drivers
|
||||
and hence are in a single service.</p>
|
||||
|
||||
|
||||
<h3>In-depth guide: Creating a service</h3>
|
||||
|
||||
<p>This section will teach you how to write your own
|
||||
service.</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<p>Make the service interface header.</p>
|
||||
|
||||
<p>We will be calling our service demo for demonstration
|
||||
purposes. First, create the header file, which goes
|
||||
in <tt>include/freetype/internal/services</tt>, and
|
||||
add the boilerplate.</p>
|
||||
|
||||
<pre>
|
||||
#include FT_INTERNAL_SERVICE_H
|
||||
FT_BEGIN_HEADER
|
||||
#define FT_SERVICE_ID_DEMO "demo"
|
||||
|
||||
/* ... */
|
||||
|
||||
FT_END_HEADER</pre>
|
||||
|
||||
<p>This line in particular is required to register the
|
||||
new service later on.</p>
|
||||
|
||||
<pre>
|
||||
#define <em>service-id service-tag</em></pre>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<p>We will have identified some functions that are
|
||||
needed in another module. Extract the function
|
||||
signatures of these and place them in the header.</p>
|
||||
|
||||
<pre>
|
||||
[typedef <em>return-type</em>
|
||||
(*<em>type-name</em>)(<em>function-signature</em>);]+</pre>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre>
|
||||
typedef FT_Error
|
||||
(*SampleDoSomethingFunc)( int foo );
|
||||
typedef void
|
||||
(*SampleDoAnotherFunc)( int foo,
|
||||
float bar );</pre>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<p>Define the service interface.</p>
|
||||
|
||||
<p>Use the <tt>FT_DEFINE_SERVICE</tt> macro to do
|
||||
this.</p>
|
||||
|
||||
<pre>
|
||||
FT_DEFINE_SERVICE( <em>service-name</em> )
|
||||
{
|
||||
[<em>type-name interface-entry</em>;]+
|
||||
}</pre>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre>
|
||||
FT_DEFINE_SERVICE( Demo )
|
||||
{
|
||||
SampleDoSomethingFunc doSomething;
|
||||
SampleDoAnotherFunc doAnother;
|
||||
};</pre>
|
||||
|
||||
<p>Here is the definition of the above macro
|
||||
(in <tt>ftserv.h</tt>).</p>
|
||||
|
||||
<pre>
|
||||
#define FT_DEFINE_SERVICE( name ) \
|
||||
typedef struct FT_Service_ ## name ## Rec_ \
|
||||
FT_Service_ ## name ## Rec ; \
|
||||
typedef struct FT_Service_ ## name ## Rec_ \
|
||||
const * FT_Service_ ## name ; \
|
||||
struct FT_Service_ ## name ## Rec_</pre>
|
||||
|
||||
<p>This defines a new struct
|
||||
called <tt>FT_Service_DemoRec</tt>, along with a
|
||||
handle type for the
|
||||
struct, <tt>FT_Service_Demo</tt>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Register (and/or implement) the functions for the
|
||||
newly created interface.</p>
|
||||
|
||||
<p>In the module implementing the interface, add a
|
||||
definition like the following</p>
|
||||
|
||||
<pre>
|
||||
static const <em>service-record table-name</em> =
|
||||
{
|
||||
<em>function-name</em>
|
||||
[,<em>function-name2</em> [,...]]
|
||||
}</pre>
|
||||
|
||||
<p>which corresponds to the interface defined in
|
||||
step 3. Example:</p>
|
||||
|
||||
<pre>
|
||||
static const FT_Service_DemoRec demo_service_rec =
|
||||
{
|
||||
function1,
|
||||
function2
|
||||
};</pre>
|
||||
|
||||
<p>This initializes the function pointers table. In
|
||||
this example, <tt>function1</tt> has the function
|
||||
signature of <tt>SampleDoSomethingFunc</tt> and
|
||||
implements the <tt>doSomething</tt> functionality, and
|
||||
so on.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Register the new service.</p>
|
||||
|
||||
<p>Next, add this code to define the service list in
|
||||
this module, or append the new service to an existing
|
||||
list.</p>
|
||||
|
||||
<pre>
|
||||
static const FT_ServiceDescRec <em>service-list-name</em>[] =
|
||||
{
|
||||
{ <em>service-id</em>, &<em>table-name</em> },
|
||||
[{ <em>service-id2</em>, &<em>table-name2</em> }, [...]]
|
||||
{ NULL, NULL }
|
||||
}</pre>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre>
|
||||
static const FT_ServiceDescRec demo_services[] =
|
||||
{
|
||||
{ FT_SERVICE_ID_DEMO, &demo_service_rec },
|
||||
{ NULL, NULL }
|
||||
};</pre>
|
||||
|
||||
<p><em>service-id</em> is what we <tt>#define</tt>'d in
|
||||
the service header file in step 1. Note that
|
||||
the <tt>{NULL, NULL}</tt> sentinel value at the
|
||||
end is required.</p>
|
||||
|
||||
<p>Now we need a way for other modules to find this
|
||||
service. First, we need to implement
|
||||
the <tt>get_interface</tt> function in
|
||||
<tt>FT_Module_Class</tt>. Here is a minimal example
|
||||
that does not do any validation.</p>
|
||||
|
||||
<pre>
|
||||
FT_CALLBACK_DEF( FT_Module_Interface )
|
||||
<em>get-interface-name</em>( FT_Module module,
|
||||
const char* module_interface )
|
||||
{
|
||||
return ft_service_list_lookup( <em>service-list-name</em>,
|
||||
module_interface );
|
||||
}</pre>
|
||||
|
||||
<p>Then, pass it into the <tt>FT_DEFINE_MODULE</tt>
|
||||
macro for this module.</p>
|
||||
|
||||
<pre>
|
||||
(FT_Module_Requester) <em>get-interface-name</em></pre>
|
||||
|
||||
<p>The last step is optional but recommended, which is
|
||||
to register the new service header
|
||||
in <tt>ftserv.h</tt>.
|
||||
|
||||
<pre>
|
||||
#define FT_SERVICE_DEMO_H <freetype/internal/services/svdemo.h></pre>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<p>Use the new service.</p>
|
||||
|
||||
<p>Now, in the file that wants to use the service, add
|
||||
the following code to get the service.</p>
|
||||
|
||||
<pre>
|
||||
<em>service-record-handle</em> service;
|
||||
|
||||
|
||||
FT_FACE_FIND_GLOBAL_SERVICE( face,
|
||||
service,
|
||||
<em>service-id-tail</em> );</pre>
|
||||
|
||||
<p><tt>face</tt> should be of type <tt>FT_Face</tt>,
|
||||
which is usually the current face instance being used
|
||||
in the driver, and FreeType tries to find the service
|
||||
in the driver of this face first, before searching all
|
||||
other modules.</p>
|
||||
|
||||
<p><em>service-id-tail</em> is the part
|
||||
of <em>service-id</em>
|
||||
following <tt>FT_SERVICE_ID_</tt>.
|
||||
|
||||
<p>Now to call some function in the service.</p>
|
||||
|
||||
<pre>
|
||||
service-><em>interface-entry</em>( <em>params</em> );</pre>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre>
|
||||
FT_Service_Demo demo;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
FT_FACE_FIND_GLOBAL_SERVICE( face, demo, DEMO );
|
||||
|
||||
error = demo->doSomething(0);
|
||||
</pre>
|
||||
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="col2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html#news">News</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../index.html">Overview</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../documentation.html">Documentation</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/developer.html">Development</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/contact.html"
|
||||
class="emphasis">Contact</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- separate primary from secondary entries -->
|
||||
</li>
|
||||
|
||||
<li class="secondary">
|
||||
<a href="index.html">FreeType Design</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-1.html">Introduction</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-2.html">Components and APIs</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-3.html">Public Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-4.html">Internal Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-5.html">Module Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-6.html" class="current">Interfaces and
|
||||
Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div> <!-- id="wrapper" -->
|
||||
|
||||
<div id="TOC-bottom">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,81 +1,239 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Style-Type"
|
||||
content="text/css">
|
||||
<meta http-equiv="Content-Script-Type"
|
||||
content="text/javascript">
|
||||
<meta name="description"
|
||||
content="FreeType Documentation">
|
||||
<meta name="Author"
|
||||
content="David Turner">
|
||||
<title>The design of FreeType 2</title>
|
||||
|
||||
<link rel="icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="shortcut icon"
|
||||
href="../image/favicon_-90.ico">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../css/freetype2_-90.css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery-1.11.0.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/jquery.ba-resize.min.js">
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="../../../js/freetype2.js">
|
||||
</script>
|
||||
|
||||
<title>FreeType Design</title>
|
||||
</head>
|
||||
|
||||
<body text="#000000"
|
||||
bgcolor="#FFFFFF"
|
||||
link="#0000EF"
|
||||
vlink="#51188E"
|
||||
alink="#FF0000">
|
||||
|
||||
<h1 align=center>
|
||||
The design of FreeType 2
|
||||
</h1>
|
||||
<body>
|
||||
|
||||
<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>
|
||||
<div id="top"
|
||||
class="bar">
|
||||
<h1><a href="http://freetype.org/index.html">FreeType</a> Design</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<center>
|
||||
<table width="70%">
|
||||
<tr><td>
|
||||
<div id="wrapper">
|
||||
|
||||
<p>This document describes the details of FreeType 2's internals.
|
||||
Read this carefully if you need to understand the innards of the library
|
||||
in order to hack or extend it.</p>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colright">
|
||||
<div class="col1wrap">
|
||||
<div class="col1">
|
||||
|
||||
<table width="100%">
|
||||
<tr valign=center
|
||||
bgcolor="#CCCCFF">
|
||||
<td align=center>
|
||||
<h2>
|
||||
Table of Contents
|
||||
</h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<center>
|
||||
<table width="80%">
|
||||
<tr><td>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<h2>
|
||||
<div id="introduction">
|
||||
<p>This document gives an overview of some FreeType 2
|
||||
internals. Read this carefully if you want to understand
|
||||
the innards of the library in order to hack or extend
|
||||
it.</p>
|
||||
|
||||
<p>Note that many, quite important details are still
|
||||
missing, which are hopefully addressed in the not too
|
||||
distant future. Volunteers to help with this task are
|
||||
highly welcomed!</p>
|
||||
</div>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="contents">
|
||||
<h3><a href="design-1.html">Introduction</a></h3>
|
||||
|
||||
<h3><a href="design-2.html">I. Components and APIs</a></h3>
|
||||
|
||||
<h3><a href="design-3.html">II. Public Objects and
|
||||
Classes</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="design-3.html#section-1">1. Object Orientation
|
||||
in FreeType 2</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-3.html#section-2">2. The <tt>FT_Library</tt>
|
||||
class</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-3.html#section-3">3. The <tt>FT_Face</tt>
|
||||
class</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-3.html#section-4">4. The <tt>FT_Size</tt>
|
||||
class</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-3.html#section-5">5. The <tt>FT_GlyphSlot</tt>
|
||||
class</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-3.html#section-6">6. The <tt>FT_CharMap</tt>
|
||||
class</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-3.html#section-7">7. Objects
|
||||
Relationship</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3><a href="design-4.html">III. Internal Objects and
|
||||
Classes</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="design-4.html#section-1">1. Memory Management</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-4.html#section-2">2. Input Streams</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-4.html#section-3">3. Modules</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-4.html#section-4">4. Summary</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3><a href="design-5.html">IV. Module Classes</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="design-5.html#section-1">1. The <tt>FT_Module_Class</tt>
|
||||
Structure</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="design-5.html#section-2">2. The <tt>FT_Module</tt>
|
||||
Type</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3><a href="design-6.html">V. Interfaces and
|
||||
Services</a></h3>
|
||||
</div>
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="col2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html#news">News</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../index.html">Overview</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="../documentation.html">Documentation</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/developer.html">Development</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/contact.html"
|
||||
class="emphasis">Contact</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- separate primary from secondary entries -->
|
||||
</li>
|
||||
|
||||
<li class="secondary">
|
||||
<a href="index.html" class="current">FreeType Design</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-1.html">Introduction</a>
|
||||
</h2>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-2.html">Components and APIs</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-3.html">Public Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-4.html">Internal Objects and Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-5.html">Module Classes</a>
|
||||
</li>
|
||||
<li class="tertiary">
|
||||
<a href="design-6.html">Interfaces and Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h2>
|
||||
<a href="design-2.html">I. Components and APIs</a>
|
||||
</h2>
|
||||
</div> <!-- id="wrapper" -->
|
||||
|
||||
<h2>
|
||||
<a href="design-3.html">II. Public Objects and Classes</a>
|
||||
</h2>
|
||||
<div id="TOC-bottom">
|
||||
</div>
|
||||
|
||||
<h2>
|
||||
<a href="design-4.html">III. Internal Objects and Classes</a>
|
||||
</h2>
|
||||
|
||||
<h2>
|
||||
<a href="design-5.html">IV. Module Classes</a>
|
||||
</h2>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -108,7 +108,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 8-Sep-2016</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -127,22 +127,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -176,7 +176,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 02-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -195,22 +195,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -287,7 +287,7 @@
|
||||
<p>The following table summarizes the pros and cons of each
|
||||
scheme.</p>
|
||||
|
||||
<table>
|
||||
<table class="vertical-space">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">
|
||||
@ -384,7 +384,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 02-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -403,22 +403,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -433,7 +433,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 02-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -452,22 +452,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -188,7 +188,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 02-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -207,22 +207,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -356,7 +356,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 02-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -375,22 +375,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -178,7 +178,7 @@
|
||||
single contour, however, no font driver of FreeType
|
||||
produces such outlines currently.</p>
|
||||
|
||||
<table>
|
||||
<table class="vertical-space">
|
||||
<tr>
|
||||
<td>
|
||||
<img src="points_segment.png"
|
||||
@ -217,7 +217,7 @@
|
||||
called <a href="../reference/ft2-outline_processing.html#FT_Outline"><code>FT_Outline</code></a>.
|
||||
Right now, the following fields are of interest:</p>
|
||||
|
||||
<table>
|
||||
<table class="vertical-space">
|
||||
<caption>
|
||||
<b><code>FT_Outline</code></b>
|
||||
</caption>
|
||||
@ -320,7 +320,7 @@
|
||||
|
||||
<p>Unlike the bbox, the cbox is much faster to compute.</p>
|
||||
|
||||
<table>
|
||||
<table class="vertical-space">
|
||||
<tr>
|
||||
<td>
|
||||
<img src="bbox1.png"
|
||||
@ -440,7 +440,7 @@ height = (ymax - ymin)/64</pre>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 02-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -459,22 +459,25 @@ height = (ymax - ymin)/64</pre>
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -113,7 +113,7 @@
|
||||
called <a href="../reference/ft2-basic_types.html#FT_Bitmap"><code>FT_Bitmap</code></a>.
|
||||
The fields we are interested in are:</p>
|
||||
|
||||
<table>
|
||||
<table class="vertical-space">
|
||||
<caption>
|
||||
<b><code>FT_Bitmap</code></b>
|
||||
</caption>
|
||||
@ -199,7 +199,7 @@
|
||||
needed to skip to the <em>next lower scanline</em> in a
|
||||
given bitmap buffer.</p>
|
||||
|
||||
<table>
|
||||
<table class="vertical-space">
|
||||
<tr>
|
||||
<td>
|
||||
<img src="up_flow.png"
|
||||
@ -338,7 +338,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 02-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -357,22 +357,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -193,7 +193,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 07-Dec-2014</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -212,22 +212,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -246,7 +246,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 7-Dec-2014</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -265,22 +265,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -234,7 +234,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 8-Sep-2016</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -253,22 +253,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -428,7 +428,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 12-Feb-2016</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -447,22 +447,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -32,6 +32,9 @@ draw_bitmap( FT_Bitmap* bitmap,
|
||||
FT_Int y_max = y + bitmap->rows;
|
||||
|
||||
|
||||
/* for simplicity, we assume that `bitmap->pixel_mode' */
|
||||
/* is `FT_PIXEL_MODE_GRAY' (i.e., not a bitmap font) */
|
||||
|
||||
for ( i = x, p = 0; i < x_max; i++, p++ )
|
||||
{
|
||||
for ( j = y, q = 0; j < y_max; j++, q++ )
|
||||
@ -106,6 +109,9 @@ main( int argc,
|
||||
100, 0 ); /* set character size */
|
||||
/* error handling omitted */
|
||||
|
||||
/* cmap selection omitted; */
|
||||
/* for simplicity we assume that the font contains a Unicode cmap */
|
||||
|
||||
slot = face->glyph;
|
||||
|
||||
/* set up matrix */
|
||||
|
@ -131,7 +131,7 @@
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 7-Dec-2014</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -150,22 +150,25 @@
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -1005,7 +1005,7 @@ for ( n = 0; n < num_chars; n++ )
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 2-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1024,22 +1024,25 @@ for ( n = 0; n < num_chars; n++ )
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -993,7 +993,9 @@ void compute_string_bbox( FT_BBox *abbox )
|
||||
results. In case you need 1-bit monochrome bitmaps, it is
|
||||
even necessary to actually render the glyphs because the
|
||||
rules for the conversion from outline to bitmap can also
|
||||
be controlled by hinting instructions.</p>
|
||||
be controlled by hinting instructions
|
||||
(cf. <a href="https://www.microsoft.com/typography/TrueTypeScanConversion.mspx">dropout
|
||||
control</a>).</p>
|
||||
|
||||
<pre>
|
||||
<span class="comment">/* compute string dimensions in integer pixels */</span>
|
||||
@ -1521,7 +1523,7 @@ pixels_y = design_y * y_scale;</pre>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 2-May-2017</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1540,22 +1542,25 @@ pixels_y = design_y * y_scale;</pre>
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
@ -102,7 +102,7 @@ example5 LiberationSerif-Bold.ttf @</pre>
|
||||
<!-- ************************************************** -->
|
||||
|
||||
<div class="updated">
|
||||
<p>Last update: 8-Sep-2016</p>
|
||||
<p>Last update: 13-Feb-2018</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -121,22 +121,25 @@ example5 LiberationSerif-Bold.ttf @</pre>
|
||||
<div id="TOC">
|
||||
<ul>
|
||||
<li class="funding">
|
||||
<p><a href="https://pledgie.com/campaigns/24434">
|
||||
<img alt="Click here to lend your support to the FreeType project and make a donation at pledgie.com!"
|
||||
src="https://pledgie.com/campaigns/24434.png?skin_name=chrome"
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post"
|
||||
target="_top">
|
||||
<input type="hidden"
|
||||
name="cmd"
|
||||
value="_s-xclick">
|
||||
<input type="hidden"
|
||||
name="hosted_button_id"
|
||||
value="SK827YKEALMT4">
|
||||
<input type="image"
|
||||
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
|
||||
name="submit"
|
||||
alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt=""
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
|
||||
<p><a href="https://flattr.com/submit/auto?fid=mq2xxp&url=https%3A%2F%2Fwww.freetype.org"
|
||||
target="_blank">
|
||||
<img class="with-border"
|
||||
src="https://button.flattr.com/flattr-badge-large.png"
|
||||
alt="Flattr this"
|
||||
title="Flattr this"
|
||||
border="0"
|
||||
align="middle">
|
||||
</a></p>
|
||||
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
|
||||
width="1"
|
||||
height="1">
|
||||
</form>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<a href="http://freetype.org/index.html">Home</a>
|
||||
|
Loading…
Reference in New Issue
Block a user