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

📄 glyf.htm

📁 TrueType字库标准文档
💻 HTM
字号:
<HTML>
<HEAD>
<TITLE>The 'glyf' Table</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><IMG WIDTH=100 HEIGHT=1 ALT="" SRC="/truetype/otspec/pixel.gif" BORDER=0></TD>
<TD><H1>Table Formats</H1></TD>
</TR>

<TR><TD></TD><TD ALIGN=TOP><H2> glyf - Glyph Data</H2>
<P>
This table contains information that describes the glyphs in the
font. Each glyph begins with the following header:

<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>SHORT</TD><TD VALIGN=TOP>numberOfContours</TD><TD VALIGN=TOP>If the number of contours is greater than or equal to zero, this is a single glyph; if negative, this is a composite glyph.</TR>
<TR><TD VALIGN=TOP>FWord</TD><TD VALIGN=TOP>xMin</TD><TD VALIGN=TOP>Minimum x for coordinate data.</TD></TR>
<TR><TD VALIGN=TOP>FWord</TD><TD VALIGN=TOP>yMin</TD><TD VALIGN=TOP>Minimum y for coordinate data.</TD></TR>
<TR><TD VALIGN=TOP>FWord</TD><TD VALIGN=TOP>xMax</TD><TD VALIGN=TOP>Maximum x for coordinate data.</TD></TR>
<TR><TD VALIGN=TOP>FWord</TD><TD VALIGN=TOP>yMax</TD><TD VALIGN=TOP>Maximum y for coordinate data.</TD></TR>
</TABLE>&nbsp;&nbsp;
<P>
Note that the bounding rectangle from each
character is defined as the rectangle with a lower left corner
of (xMin, yMin) and an upper right corner of (xMax, yMax).
<P>
<CITE>Note: The scaler will perform better if
the glyph coordinates have been created such that the xMin is
equal to the lsb. For example, if the lsb is 123, then xMin for
the glyph should be 123. If the lsb is -12 then the xMin should
be -12. If the lsb is 0 then xMin is 0. If all glyphs are done
like this, set bit 1 of flags field in the 'head' table.</CITE>

<H4>Simple Glyph Description</H4>
<P>
This is the table information needed if numberOfContours
is greater than zero, that is, a glyph is not a composite.

<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>USHORT</TD><TD VALIGN=TOP>endPtsOfContours[<CITE>n</CITE>]</TD><TD VALIGN=TOP>Array of last points of each contour; <CITE>n</CITE>  is the number of contours.</TD></TR>
<TR><TD VALIGN=TOP>USHORT</TD><TD VALIGN=TOP>instructionLength</TD><TD VALIGN=TOP>Total number of bytes for instructions.</TD></TR>
<TR><TD VALIGN=TOP>BYTE</TD><TD VALIGN=TOP>instructions[<CITE>n</CITE>]</TD><TD VALIGN=TOP>Array of instructions for each glyph; <CITE>n  </CITE>is the number of instructions.</TD></TR>
<TR><TD VALIGN=TOP>BYTE</TD><TD VALIGN=TOP>flags[<CITE>n</CITE>]</TD><TD VALIGN=TOP>Array of flags for each coordinate in outline; <CITE>n</CITE>  is the number of flags.</TD></TR>
<TR><TD VALIGN=TOP>BYTE or SHORT</TD><TD VALIGN=TOP>xCoordinates[ ]</TD><TD VALIGN=TOP>First coordinates relative to (0,0); others are relative to previous point.</TD></TR>
<TR><TD VALIGN=TOP>BYTE or SHORT</TD><TD VALIGN=TOP>yCoordinates[ ]</TD><TD VALIGN=TOP>First coordinates relative to (0,0); others are relative to previous point.</TD></TR>
</TABLE>&nbsp;&nbsp;
<P>
Note: In the glyf table, the position of a
point is not stored in absolute terms but as a vector relative
to the previous point. The delta-x and delta-y vectors represent
these (often small) changes in position.
<P>
Each flag is a single byte. Their meanings are shown below.

<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Flags</TH><TH BGCOLOR="#C0C0C0">Bit</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>On Curve</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>If set, the point is on the curve; otherwise, it is off the curve.</TD></TR>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>x-Short Vector</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>If set, the corresponding x-coordinate is 1 byte long, not 2.</TD></TR>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>y-Short Vector</TD><TD VALIGN=TOP>2</TD><TD VALIGN=TOP>If set, the corresponding y-coordinate is 1 byte long, not 2.</TD></TR>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>Repeat</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>If set, the next byte specifies the number of additional times this set of flags is to be repeated. In this way, the number of flags listed can be smaller than the number of points in a character.</TD></TR>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>This x is same<BR>(Positive x-Short Vector)</TD><TD VALIGN=TOP>4</TD><TD VALIGN=TOP>This flag has two meanings, depending on how the x-Short Vector flag is set. If x-Short Vector is set, this bit describes the sign of the value, with 1 equalling positive and 0 negative. If the x-Short Vector bit is not set and this bit is set, then the current x-coordinate is the same as the previous x-coordinate. If the x-Short Vector bit is not set and this bit is also not set, the current x-coordinate is a signed 16-bit delta vector.</TD></TR>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>This y is same<BR>(Positive y-Short Vector)</TD><TD VALIGN=TOP>5</TD><TD VALIGN=TOP>This flag has two meanings, depending on how the y-Short Vector flag is set. If y-Short Vector is set, this bit describes the sign of the value, with 1 equalling positive and 0 negative. If the y-Short Vector bit is not set and this bit is set, then the current y-coordinate is the same as the previous y-coordinate. If the y-Short Vector bit is not set and this bit is also not set, the current y-coordinate is a signed 16-bit delta vector.</TD></TR>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>Reserved</TD><TD VALIGN=TOP>6</TD><TD VALIGN=TOP NOWRAP=NOWRAP>This bit is reserved. Set it to zero.</TD></TR>
<TR><TD VALIGN=TOP NOWRAP=NOWRAP>Reserved</TD><TD VALIGN=TOP>7</TD><TD VALIGN=TOP NOWRAP=NOWRAP>This bit is reserved. Set it to zero.</TD></TR>
</TABLE>&nbsp;&nbsp;<P>
<P><BR><H4>Composite Glyph Description</H4>
<P>
This is the table information needed for composite
glyphs (numberOfContours is -1). A composite glyph starts with
two USHORT values (&quot;flags&quot; and &quot;glyphIndex,&quot;
i.e. the index of the first contour in this composite glyph);
the data then varies according to &quot;flags&quot;). The C pseudo-code
fragment below shows how the composite glyph information is stored
and parsed; definitions for &quot;flags&quot; bits follow this
fragment:
<PRE>
do {
	USHORT flags;
	USHORT glyphIndex;
	if ( flags &amp; ARG_1_AND_2_ARE_WORDS) {
	(SHORT or FWord) argument1;
	(SHORT or FWord) argument2;
	} else {
		USHORT arg1and2; /* (arg1 &lt;&lt; 8) | arg2 */
	}
	if ( flags &amp; WE_HAVE_A_SCALE ) {
		F2Dot14  scale;    /* Format 2.14 */
	} else if ( flags &amp; WE_HAVE_AN_X_AND_Y_SCALE ) {
		F2Dot14  xscale;    /* Format 2.14 */
		F2Dot14  yscale;    /* Format 2.14 */
	} else if ( flags &amp; WE_HAVE_A_TWO_BY_TWO ) {
		F2Dot14  xscale;    /* Format 2.14 */
		F2Dot14  scale01;   /* Format 2.14 */
		F2Dot14  scale10;   /* Format 2.14 */
		F2Dot14  yscale;    /* Format 2.14 */
	}
} while ( flags &amp; MORE_COMPONENTS ) 
if (flags &amp; WE_HAVE_INSTR){
	USHORT numInstr
	BYTE instr[numInstr]
</PRE>
<P>
Argument1 and argument2 can be either x and
y offsets to be added to the glyph or two point numbers. In the
latter case, the first point number indicates the point that is
to be matched to the new glyph. The second number indicates the
new glyph's &quot;matched&quot; point. Once a glyph is added,
its point numbers begin directly after the last glyphs (endpoint
of first glyph + 1).
<P>
When arguments 1 and 2 are an x and a y offset
instead of points and the bit ROUND_XY_TO_GRID is set to 1, the
values are rounded to those of the closest grid lines before they
are added to the glyph. X and Y offsets are described in FUnits.
<P>
If the bit WE_HAVE_A_SCALE is set, the scale value is read in
2.14 format-the value can be between -2 to almost +2. The glyph
will be scaled by this value before grid-fitting.
<P>
The bit WE_HAVE_A_TWO_BY_TWO allows for an interrelationship between
the x and y coordinates. This could be used for 90-degree rotations,
for example. 
<P>
These are the constants for the flags field:

<TABLE WIDTH=480 BGCOLOR="#F0F0F0">
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Flags</TH><TH BGCOLOR="#C0C0C0">Bit</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>ARG_1_AND_2_ARE_WORDS</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>If this is set, the arguments are words; otherwise, they are bytes.</TD></TR>
<TR><TD VALIGN=TOP>ARGS_ARE_XY_VALUES<TD VALIGN=TOP>1</TD><TD VALIGN=TOP>If this is set, the arguments are xy values; otherwise, they are points.</TD></TR>
<TR><TD VALIGN=TOP>ROUND_XY_TO_GRID<TD VALIGN=TOP>2</TD><TD VALIGN=TOP>For the xy values if the preceding is true.</TD></TR>
<TR><TD VALIGN=TOP>WE_HAVE_A_SCALE<TD VALIGN=TOP>3</TD><TD VALIGN=TOP>This indicates that there is a simple scale for the component. Otherwise, scale = 1.0.</TD></TR>
<TR><TD VALIGN=TOP>RESERVED<TD VALIGN=TOP>4</TD><TD VALIGN=TOP>This bit is reserved. Set it to 0.</TD></TR>
<TR><TD VALIGN=TOP>MORE_COMPONENTS<TD VALIGN=TOP>5</TD><TD VALIGN=TOP>Indicates at least one more glyph after this one.</TD></TR>
<TR><TD VALIGN=TOP>WE_HAVE_AN_X_AND_Y_SCALE<TD VALIGN=TOP>6</TD><TD VALIGN=TOP>The x direction will use a different scale from the y direction.</TD></TR>
<TR><TD VALIGN=TOP>WE_HAVE_A_TWO_BY_TWO<TD VALIGN=TOP>7</TD><TD VALIGN=TOP>There is a 2 by 2 transformation that will be used to scale the component.</TD></TR>
<TR><TD VALIGN=TOP>WE_HAVE_INSTRUCTIONS<TD VALIGN=TOP>8</TD><TD VALIGN=TOP>Following the last component are instructions for the composite character.</TD></TR>
<TR><TD VALIGN=TOP>USE_MY_METRICS<TD VALIGN=TOP>9</TD><TD VALIGN=TOP>If set, this forces the aw and lsb (and rsb) for the composite to be equal to those from this original glyph. This works for hinted and unhinted characters.</TD></TR>
</TABLE>&nbsp;&nbsp;<P>
<P>
The purpose of USE_MY_METRICS is to force
the lsb and rsb to take on a desired value. For example, an i-circumflex
(Unicode 00ef) is often composed of the circumflex and a dotless-i.
In order to force the composite to have the same metrics as the
dotless-i, set USE_MY_METRICS for the dotless-i component of the
composite. Without this bit, the rsb and lsb would be calculated
from the HMTX entry for the composite (or would need to be explicitly
set with TrueType instructions).
<P>
Note that the behavior of the USE_MY_METRICS operation is undefined
for rotated composite components.

&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 03 September 1996

</FONT>
</TD></TR>
</TABLE>
</BODY>
</HTML>

⌨️ 快捷键说明

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