freetype2/docs/glyphs/glyphs-1.html

200 lines
6.6 KiB
HTML

<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="Author"
content="David Turner">
<title>FreeType Glyph Conventions</title>
</head>
<body text="#000000"
bgcolor="#FFFFFF"
link="#0000EF"
vlink="#51188E"
alink="#FF0000">
<h1 align=center>
FreeType Glyph Conventions
</h1>
<h2 align=center>
Version&nbsp;2.1
</h2>
<h3 align=center>
Copyright&nbsp;1998-2000 David Turner (<a
href="mailto:david@freetype.org">david@freetype.org</a>)<br>
Copyright&nbsp;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%">
&nbsp;
</td>
<td align=center
width="30%">
<a href="index.html">Contents</a>
</td>
<td align=center
width="30%">
<a href="glyphs-2.html">Next</a>
</td>
</tr>
</table>
</center>
<p><hr></p>
<table width="100%">
<tr bgcolor="#CCCCFF"
valign=center><td>
<h2>
I. Basic typographic concepts
</h2>
</td></tr>
</table>
<a name="section-1">
<h3>
1. Font files, format and information
</h3>
<p>A font is a collection of various character images that can be used
to display or print text. The images in a single font share some common
properties, including look, style, serifs, etc. Typographically
speaking, one has to distinguish between a <em>font family</em> and its
multiple <em>font faces</em>, which usually differ in style though come
from the same template.</p>
For example, "Palatino Regular" and "Palatino Italic" are two distinct
<em>faces</em> from the same famous <em>family</em>, called "Palatino"
itself.</p>
<p>The single term <em>font</em> is nearly always used in ambiguous ways
to refer to either a given family or given face, depending on the
context. For example, most users of word-processors use "font" to
describe a font family (e.g. "Courier", "Palatino", etc.); however most
of these families are implemented through several data files depending
on the file format: For TrueType, this is usually one per face (i.e.
<tt>arial.ttf</tt> for "Arial Regular", <tt>ariali.ttf</tt> for "Arial
Italic", etc.). The file is also called a "font" but really contains a
font face.</p>
<p>A <em>digital font</em> is thus a data file that may contain <em>one
or more font faces</em>. For each of these, it contains character
images, character metrics, as well as other kind of information
important to the layout of text and the processing of specific character
encodings. In some awkward formats, like Adobe's Type&nbsp;1, a single
font face is described through several files (i.e. one contains the
character images, another one the character metrics). We will ignore
this implementation issue in most parts of this document and consider
digital fonts as single files, though FreeType&nbsp;2.0 is able to
support multiple-files fonts correctly.</p>
<p>As a convenience, a font file containing more than one face is called
a <em>font collection</em>. This case is rather rare but can be seen in
many Asian fonts, which contain images for two or more representation
forms of a given scripts (usually for horizontal and vertical
layout.</p>
<a name="section-2">
<h3>
2. Character images and mappings
</h3>
<p>The character images are called <em>glyphs</em>. A single character
can have several distinct images, i.e. several glyphs, depending on
script, usage or context. Several characters can also take a single
glyph (good examples are Roman ligatures like "fi" and "fl" which can be
represented by a single glyph). The relationships between characters
and glyphs can be very complex, but won't be discussed in this document.
Moreover, some formats use more or less awkward schemes to store and
access glyphs. For the sake of clarity, we only retain the following
notions when working with FreeType:</p>
<ul>
<li>
<p>A font file contains a set of glyphs; each one can be stored as a
bitmap, a vector representation or any other scheme (most scalable
formats use a combination of mathematical representation and control
data/programs). These glyphs can be stored in any order in the font
file, and is typically accessed through a simple glyph index.</p>
</li>
<li>
<p>The font file contains one or more tables, called a <em>character
map</em> (or charmap in short), which is used to convert character
codes for a given encoding (e.g. ASCII, Unicode, DBCS, Big5, etc..)
into glyph indices relative to the font file. A single font face
may contain several charmaps. For example, most TrueType fonts
contain an Apple-specific charmap as well as a Unicode charmap,
which makes them usable on both Mac and Windows platforms.</p>
</li>
</ul>
<a name="section-3">
<h3>
3. Character and font metrics
</h3>
<p>Each glyph image is associated with various metrics which are used to
describe how it must be placed and managed when rendering text. These
are described in more details in section&nbsp;III; they relate to glyph
placement, cursor advances as well as text layout. They are extremely
important to compute the flow of text when rendering a string of
text.</p>
<p>Each scalable format also contains some global metrics, expressed in
notional units, to describe some properties of all glyphs in the same
face. Examples for global metrics are the maximum glyph bounding box,
the ascender, descender and text height for the font.</p>
<p>Though these metrics also exist for non-scalable formats, they only
apply for a set of given character dimensions and resolutions, and are
usually expressed in pixels.</p>
<p><hr></p>
<center>
<table width="100%"
border=0
cellpadding=5>
<tr bgcolor="#CCFFCC" valign=center>
<td align=center
width="30%">
&nbsp;
</td>
<td align=center
width="30%">
<a href="index.html">Contents</a>
</td>
<td align=center
width="30%">
<a href="glyphs-2.html">Next</a>
</td>
</tr>
</table>
</center>
</td></tr>
</table>
</center>
</body>
</html>