⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttch01.htm

📁 TrueType字库标准文档
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<HTML>
<HEAD>
<TITLE>TrueType Fundamentals</TITLE>
<STYLE>
<!--
	BODY  {background: #FFFFFF; link: #000080}
	H1	{font-size: 24pt; color: #c60029}
	H2	{font-size: 18pt; color: black}
	H3    {font-size: 16pt; color: black}
	H4    {font-size: 14pt; color: black}
 CAPTION    {font-size: 16pt; font-weight: Bold}
	A:link {text-decoration: none}
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000080">
<TABLE WIDTH=480 CELLPADDING=8 CELLSPACING=0 BORDER=0>

<TR><TD VALIGN=TOP><IMG   WIDTH=100 HEIGHT=1 ALT="" SRC="/truetype/otspec/pixel.gif" BORDER=0></TD>
<TD VALIGN=TOP><H1>TrueType Fundamentals</H1></TD>
</TR>

<TR><TD VALIGN=TOP></TD><TD ALIGN=TOP>
<P>
OpenType fonts are an extension of the TrueType Font File format.
<P>
This chapter introduces the basic concepts needed to create and
instruct a TrueType font, or an OpenType font that contains TrueType outline data. It begins with an overview of the steps
involved in taking a design from paper to the creation of a bitmap
that can be sent to an output device and follows with a closer
look at each of the steps in the process. 

<P><BR><H3> From design to font file 
</H3>
<P>
 A TrueType font can originate as a new design
drawn on paper or created on a computer screen. TrueType fonts
can also be obtained by converting fonts from other formats. Whatever
the case, it is necessary to create a TrueType font file that,
among other things, describes each glyph in the font as an outline
in the TrueType format.  
<P><BR>
<IMG  WIDTH=514 HEIGHT=185 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00288.GIF"><BR>

<P><BR><H3> From Font File to Paper 
</H3>
<P>
 This section describes the process that allows
glyphs from a TrueType font file to be displayed on raster devices. 
<P>
First, the outline stored in the font file is scaled to the requested
size. Once scaled, the points that make up the outline are no
longer recorded in the FUnits used to describe the original outline,
but have become device-specific pixel coordinates. 
<P>
Next, the instructions associated with this glyph are carried
out by the interpreter. The result of carrying out the instructions
is a grid-fitted outline for the requested glyph. This outline
is then scan converted to produce a bitmap that can be rendered
on the target device.
<P>
<IMG  WIDTH=559 HEIGHT=584 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00289.GIF">
<P><BR><H3>Digitizing a Design</H3>
<P>
 This section describes the coordinate system
used to establish the locations of the points that define a glyph
outline. It also documents the placement of glyphs with respect
to the coordinate axes. 

<P><BR><H4> Outlines </H4>
<P>
 In a TrueType font, glyph shapes are described
by their outlines. A glyph outline consists of a series of contours.
A simple glyph may have only one contour. More complex glyphs
can have two or more contours. Composite glyphs can be constructed
by combining two or more simpler glyphs. Certain control characters
that have no visible manifestation will map to the glyph with
no contours.<P>Figure 1-1  Glyphs with one, two, three contours respectively
 
<P><BR>
<IMG  WIDTH=100 HEIGHT=157 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00290.GIF"> <IMG  WIDTH=46 HEIGHT=161 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00291.GIF"> <IMG  WIDTH=149 HEIGHT=157 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00292.GIF"> <BR>
<P>
 Contours are composed of straight lines and
curves. Curves are defined by a series of points that describe
second order Bezier-splines. The TrueType Bezier&#173;spline format
uses two types of points to define curves, those that are <CITE>on</CITE>
the curve and those that are <CITE>off</CITE> the curve. Any combination
of off and on curve points is acceptable when defining a curve.
Straight lines are defined by two consecutive on curve points.<P>Figure
1-2 A glyph description consisting of a series of on and off curve
points<BR> 
<P>
<IMG  WIDTH=195 HEIGHT=246 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00293.GIF"><BR>
<P>
The points that make up a curve must be numbered in consecutive
order. It makes a difference whether the order is increasing or
decreasing in determining the fill pattern of the shapes that
make up the glyph. The direction of the curves has to be such
that, if the curve is followed in the direction of increasing
point numbers, the black space (the filled area) will always be
to the right.
 
<P><BR><H4> FUnits and the em square 
</H4>
<P>
 In a TrueType font file point locations are
described in font units, or FUnits. An FUnit is the smallest measurable
unit in the em square, an imaginary square that is used to size
and align glyphs. The dimensions of the em square typically are
those of the full body height of a font plus some extra spacing
to prevent lines of text from colliding when typeset without extra
leading.<BR>
<P>
<IMG  WIDTH=353 HEIGHT=180 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00294.GIF"> <BR>
<P>
While in the days of metal type, glyphs could not extend beyond
the em square, digital typefaces are not so constrained. The em
square may be made large enough to completely contain all glyphs,
including accented glyphs. Or, if it proves convenient, portions
of glyphs may extend outside the em square. TrueType fonts can
handle either approach so the choice is that of the font manufacturer. Figure
1-3 A character that extends outside of the em square
 
<P><BR>
    <IMG  WIDTH=128 HEIGHT=131 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00295.GIF"><BR>
<P>
 The em square defines a two-dimensional coordinate
grid whose <CITE>x</CITE>-axis describes movement in a horizontal direction
and whose <CITE>y</CITE>-axis describes movement in a vertical direction.
This is discussed in more detail in the following section.  
<P><BR><H4> FUnits and the grid </H4>
<P>
 A key decision in digitizing a font is determining
the resolution at which the points that make up glyph outlines
will be described. The points represent locations in a grid whose
smallest addressable unit is known as an FUnit or font Unit. The
grid is a two-dimensional coordinate system whose <CITE>x</CITE>-axis
describes movement in a horizontal direction and whose <CITE>y</CITE>-axis
describes movement in a vertical direction. The grid origin has
the coordinates (0,0). The grid is not an infinite plane. Each
point must be within the range -16384 and +16383 FUnits. Depending
upon the resolution chosen, the range of addressable grid locations
will be smaller.  
<P>
The choice of the granularity of the coordinate grid-that is,
number of units per em (upem)-is made by the font manufacturer.
Outline scaling will be fastest if units per em is chosen to be
a power of 2, such as 2048. <P>Figure 1-4  The
coordinate system  
<P><BR>
<IMG  WIDTH=336 HEIGHT=299 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00296.GIF"><BR>
<P>
 The origin of the em square need not have
any consistent relationship to the glyph outlines. In practice,
however, applications depend upon the existence of some convention
for the placement of glyphs for a given font. For Roman fonts,
which are intended to be laid out horizontally, a <CITE>y</CITE>-coordinate
value of 0 typically is assumed to correspond to the baseline
of the font.  No particular meaning is assigned to an <CITE>x</CITE>&#173;coordinate
of 0 but manufacturers may improve the performance of applications
by choosing a standard meaning for the <CITE>x</CITE>&#173;origin.  
<P>
 For example, you might place a glyph so that
its aesthetic center is at the <CITE>x</CITE>&#173;coordinate value
of 0. That is, a set of glyphs so designed when placed in a column
such that their <CITE>x</CITE>&#173;coordinate values of 0 are coincident
will appear to be nicely centered. This option would be used for
Kanji or any fonts that are typeset vertically.  Another alternative
is to place each glyph so that its leftmost extreme outline point
has an <CITE>x</CITE>-value equal to the left-side-bearing of the glyph.
Fonts created in this way may allow some applications to print
more quickly to PostScript printers. <P>Figure 1-5  Two possible
choices for the glyph origin in a Roman font. In the first case
(left) the left side bearing is <CITE>x</CITE>-zero. In the second (right),
the aesthetic center of the character is <CITE>x</CITE>-zero 
<P><BR>
<IMG  WIDTH=524 HEIGHT=270 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00297.GIF"><BR>
<P>
 Non-Roman fonts may wish to use other conventions
for the meaning of the <CITE>x</CITE>&#173;origin and <CITE>y</CITE>&#173;origin.
For best results with high-lighting and carets, the body of the
character should be roughly centered within the advance width.
For example, a symmetrical character would have equal left and
right side bearings. 
<P>
The granularity of the em square is determined by the number of
FUnits per em, or more simply units per em . The em square as
divided into FUnits defines a coordinate system with one unit
equaling an FUnit. All points defined in this coordinate system
must have integral locations. The greater the number of units
per em, the greater the precision available in addressing locations
within the em square. <P>Figure 1-6 Two em squares,
8 units per em (left), 16 units per em (right) 
<P><BR>
<IMG  WIDTH=217 HEIGHT=197 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00298.GIF"> &nbsp; &nbsp; <IMG  WIDTH=197 HEIGHT=197 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00299.GIF"><BR> 
<P>
 FUnits are relative units because they vary
in size as the size of the em square changes. The number of units
per em remains constant for a given font regardless of the point
size. The number of points per em, however, will vary with the
point size of a glyph. An em square is exactly 9 points high when
a glyph is displayed at 9 points, exactly 10 points high when
the font is displayed at 10 point, and so on. Since the number
of units per em does not vary with the point size at which the
font is displayed, the absolute size of an FUnit varies as the
point size varies. <P>Figure 1-7 72 point M and 127 point M and their
em squares.<BR>
Upem equals 8 in both cases. 
<P><BR>
<IMG  WIDTH=358 HEIGHT=207 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00300.GIF"><BR>
<P>
 Because FUnits are relative to the em square,
a given location on a glyph will have the same coordinate location
in FUnits regardless of the point size at which the font is rendered.
This is convenient because it makes it possible to instruct outline
points once considering only the original outline and have the
changes apply to the glyph at whatever size and resolution it
is ultimately rendered. 

<P><BR><H3> Scaling a glyph </H3>
<P>
 This section describes how glyph outlines
are scaled from the master size stored in the font file to the
size requested by an application.   
<P><BR><H4> Device space </H4>
<P>
 Whatever the resolution of the em square used
to define a glyph outline, before that glyph can be displayed
it must be scaled to reflect the size, transformation and the
characteristics of the output device on which it is to be displayed.
The scaled outline must describe the character outline in units
that reflect an absolute rather than relative system of measurement.
In this case the points that make up a glyph outline are described
in terms of pixels.  
<P>
Intuitively, pixels are the actual output bits that will appear
on screen or printer. To allow for greater precision in managing
outlines, TrueType describes pixel coordinates to the nearest
sixty-fourth of a pixel.
 
<P><BR><H4> Converting FUnits to pixels </H4>
<P>
 Values in the em square are converted to values
in the pixel coordinate system by multiplying them by a scale.
This scale is:  
<P>
 pointSize * resolution / 72 points per inch * units_per_em 
<P>
 where pointSize is the size at which the glyph
is to be displayed, and resolution is the resolution of the output
device. The 72 in the denominator reflects the number of points

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -