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

📄 ttch01.htm

📁 TrueType字库标准文档
💻 HTM
📖 第 1 页 / 共 3 页
字号:
and instruction definitions (IDEFs). Functions and instructions
defined in the Font Program can be used elsewhere in the font
file. 

<P><BR><H4> The CVT Program </H4>
<P>
 The CVT Program is a sequence of TrueType
instructions executed every time the point size or transformation
change. It is used to make font wide changes rather than to manage
individual glyphs. The CVT Program is used to establish the values
in the Control Value Table.  
<P>
The  purpose of the Control Value Table or CVT is to simplify
the task of maintaining consistency when instructing a font. It
is a numbered list of values that can be referenced by either
of two indirect instructions (MIRP and MIAP). CVT entries can
be used to store values that need to be the same across a number
of glyphs in a font. For example an instruction might refer to
a CVT entry whose purpose is to regularize stem weights across
a font. 
<P>Figure 1-12  Some sample CVT entries<P>
 
<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Entry #</TH><TH BGCOLOR="#C0C0C0">Value</TH><TH BGCOLOR="#C0C0C0">Description</TH><TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP>0</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>upper and lower case flat base(base line)</TD></TR>
<TR>
<TD VALIGN=TOP>1</TD><TD VALIGN=TOP>-39</TD><TD VALIGN=TOP>upper case round base</TD></TR>
<TR>
<TD VALIGN=TOP>2</TD><TD VALIGN=TOP>-35</TD><TD VALIGN=TOP>lower case round base</TD></TR>
<TR>
<TD VALIGN=TOP>3</TD><TD VALIGN=TOP>-33</TD><TD VALIGN=TOP>figure round base</TD></TR>
<TR>
<TD VALIGN=TOP>4</TD><TD VALIGN=TOP>1082</TD><TD VALIGN=TOP>x-height flat</TD></TR>
<TR>
<TD VALIGN=TOP>5</TD><TD VALIGN=TOP>1114</TD><TD VALIGN=TOP>x-height round overlap</TD></TR>
<TR>
<TD VALIGN=TOP>6</TD><TD VALIGN=TOP>1493</TD><TD VALIGN=TOP>flat cap</TD></TR>
<TR>
<TD VALIGN=TOP>7</TD><TD VALIGN=TOP>1522</TD><TD VALIGN=TOP>round cap</TD></TR>
<TR>
<TD VALIGN=TOP>8</TD><TD VALIGN=TOP>1463</TD><TD VALIGN=TOP>numbers flat</TD></TR>
<TR>
<TD VALIGN=TOP>9</TD><TD VALIGN=TOP>1491</TD><TD VALIGN=TOP>numbers round top</TD></TR>
<TR>
<TD VALIGN=TOP>10</TD><TD VALIGN=TOP>1493</TD><TD VALIGN=TOP>flat ascender</TD></TR>
<TR>
<TD VALIGN=TOP>11</TD><TD VALIGN=TOP>1514</TD><TD VALIGN=TOP>round ascender</TD></TR>
<TR>
<TD VALIGN=TOP>12</TD><TD VALIGN=TOP>157</TD><TD VALIGN=TOP>x stem weight</TD></TR>
<TR>
<TD VALIGN=TOP>13</TD><TD VALIGN=TOP>127</TD><TD VALIGN=TOP>y stem weight</TD></TR>
<TR>
<TD VALIGN=TOP>14</TD><TD VALIGN=TOP>57</TD><TD VALIGN=TOP>serif</TD></TR>
<TR>
<TD VALIGN=TOP>15</TD><TD VALIGN=TOP>83</TD><TD VALIGN=TOP>space between the dot and the I</TD></TR>
</TABLE>&nbsp;&nbsp;

<P>
 Instructions that refer to values in the CVT
are called indirect instructions as opposed to the direct instructions
which take their values from the glyph outline. 
<P>
 As part of the TrueType font file, the values
in the CVT are expressed in FUnits. When the outlines are converted
from FUnits to pixel units, values in the CVT are also converted. 
<P>
When writing to the CVT you may use a value that is in the glyph
coordinate system (using WCVTP) or you can use a value that is
in the original FUnits (using WCVTF). The interpreter will scale
all values appropriately. Values read from the CVT are always
in pixels (F26Dot6).
 
<P><BR><H4> The Storage Area </H4>
<P>
 The interpreter also maintains a Storage Area
consisting of a portion of memory that can be used for temporary
storage of data from the interpreter stack. Instructions exist
that make it possible to read the values of stored data and to
write new values to storage. Storage locations range from 0 to
n-1 where n is the value established in the maxStorage entry in
the maxProfile table of the font file. Values are 32 bit numbers<P>Figure
1-13 Some storage area entries<P>
 
<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Address</TH><TH BGCOLOR="#C0C0C0">Value</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP>0</TD><TD VALIGN=TOP>343</TD></TR>
<TR>
<TD VALIGN=TOP>1</TD><TD VALIGN=TOP>241</TD></TR>
<TR>
<TD VALIGN=TOP>2</TD><TD VALIGN=TOP>-27</TD></TR>
<TR>
<TD VALIGN=TOP>3</TD><TD VALIGN=TOP>4654</TD></TR>
<TR>
<TD VALIGN=TOP>4</TD><TD VALIGN=TOP>125</TD></TR>
<TR>
<TD VALIGN=TOP>5</TD><TD VALIGN=TOP>11</TD></TR>
</TD></TR>
</TABLE>&nbsp;&nbsp;

<P><BR><H4>The Graphics State</H4>
<P>
The Graphics State consists of a table of variables and their
values. All instructions act within the context of the Graphics
State. Graphics State variables have default values as specified
in Appendix B, &quot;Graphics State Summary&quot;. Their values
can be determined or changed using instructions. 
<P>
The Graphics State establishes the context within which all glyphs
are interpreted. All Graphics State variables have a default value.
Some of these values can be changed in the CVT Program if desired.
Whatever the default value, it will be reestablished at the start
of interpretation of any glyph. In other words, the Graphics State
has no inter-glyph memory. Changing the value of a Graphics State
variable while processing an individual glyph will result in a
change that remains in effect only for that glyph. 

<P><BR><H3> The scan converter </H3>
<P>
 The TrueType scan converter takes an outline
description of a glyph and produces a bitmap image for that glyph.
 
<P>
The TrueType scan converter offers two modes. In the first mode,
the scan converter uses a simple algorithm for determining which
pixels are part of that glyph. The rules can be stated as follows:
<MENU>
<LI> Rule 1 
<LI><CITE> If a pixel's center falls within the glyph outline, that
pixel is turned on and becomes part of that glyph. </CITE>
<LI>Rule 2
<LI><CITE> If a contour falls exactly on a pixel's center, that pixel
is turned on. </CITE>
</MENU>
<P>
 A point is considered to be an interior point
of a glyph if it has a non-zero winding number. The winding number
is itself determined by drawing a ray from the point in question
toward infinity. (The direction in which the ray points in unimportant.)
Starting with a count of zero, we subtract one each time a glyph
contour crosses the ray from right to left or bottom to top. Such
a crossing is termed an on transition. We add one each time a
contour of the glyph crossed the ray from left to right or top
to bottom. Such a crossing is termed an off transition. If the
final count is non-zero, the point is an interior point.  
<P>
The direction of a contour can be determined by looking at the
point numbers. The direction is always from lower point number
toward higher point number. 
<P>
The illustration that follows demonstrates the use of winding
numbers in determining whether a point is inside a glyph. The
point p1 undergoes a sequence of four transitions (<CITE>on </CITE>transition,<CITE>
off </CITE>transition, <CITE>on </CITE>transition, <CITE>off </CITE>transition).
Since the sequence is even, the winding number is zero and the
point is not inside the glyph. The second point, p2, undergoes
an <CITE>off </CITE>transition followed by an <CITE>on </CITE>transition followed
by an <CITE>off </CITE>transition yielding a winding number of +1. The
point is in the interior of the glyph. Figure
1-14 Determining the winding number of a point 
<P>
<IMG  WIDTH=255 HEIGHT=217 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00312.GIF">

<P><BR><H4> What is a dropout? </H4>
<P>
 A dropout occurs whenever there is a connected
region of a glyph interior that contains two black pixels that
cannot be connected by a straight line that only passes through
black pixels. <P>Figure 1-15 The letter m with two dropouts 
<P>
<IMG  WIDTH=268 HEIGHT=320 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/IMG00313.GIF">

<P><BR><H4> Preventing dropouts </H4>
<P>
 The TrueType instructions are designed to
allow you to gridfit a glyph so that the desired pixels will be
turned on by the simple scan converter regardless of the point
size or the transformation used. It may prove difficult to foresee
all possible transformations that a glyph might undergo. It is
therefore difficult to instruct a glyph to ensure that the proper
grid-fitting distortion of the outline will take place for every
desired transformation. This problem is especially difficult for
very small numbers of pixels per em and for complex typefaces.
In these situations, some renditions of a glyph may contain dropouts. 
<P>
 It is possible to test for potential dropouts
by looking at an imaginary line segment connecting two adjacent
pixel centers. If this line segment is intersected by both an
on-Transition contour and an off-Transition contour, a potential
dropout condition exists. The potential dropout only becomes an
actual dropout if the two contour lines continue on in both directions
to cut other line segments between adjacent pixel centers. If
the two contours join together immediately after crossing a scan
line (forming a stub), a dropout does not occur, although a stem
of the glyph may become shorter than desired. 
<P>
To prevent dropouts, type manufacturers can choose to have the
scan converter use two additional rules:
<DL>
<DT> Rule 3 
<DD> <CITE>If a scan line between two adjacent pixel centers (either
vertical or horizontal)  is intersected by both an on-Transition
contour and an off-Transition contour and neither of the pixels
was already turned on by rules 1 and 2, turn on the left-most
pixel (horizontal scan line) or the bottom-most pixel (vertical
scan line) </CITE>
<DT>Rule 4
<DD> <CITE>Apply Rule 3 only if the two contours continue to intersect
other scan lines in both directions. That is do not turn on pixels
for 'stubs'. The scanline segments that form a square with the
intersected scan line segment are examined to verify that they
are intersected by two contours.  It is possible that these could
be different contours than the ones intersecting the dropout scan
line segment.  This is very unlikely but may have to be controlled
with grid-fitting in some exotic glyphs.</CITE>
</DL>
<P>
 The type manufacturer can choose to use the
simple scan converter employing rules 1 and 2 only or may optionally
invoke either rule 3 or rule 4. The decision about which scan
converter to use can be made on a font wide basis or a different
choice can be specified for each glyph. The selection made in
the preProgram will be the default for the entire font. A change
made to the default in the instructions for an individual glyph
will apply only to that glyph. 

&nbsp;<br>&nbsp;<br>
<FONT FACE="Arial, Helvetica" SIZE=1>
Microsoft Typography Web Site <A HREF="/truetype/otspec/CPYRIGHT.htm">&copy; 1996 Microsoft Corporation</A>
<BR>
Comments to the Microsoft Typography group: <A HREF="mailto:ttwsite@microsoft.com">ttwsite@microsoft.com</A>
<BR>
<A HREF="/truetype/default.htm">Home</a> | <a href="/truetype/creators.htm">Information for Developers</a>
&nbsp;<BR>
Last updated 05 September 1996
</FONT>
</TD>
</TABLE>
</BODY>
</HTML>

⌨️ 快捷键说明

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