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

📄 gdef.htm

📁 TrueType字库标准文档
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<HTML>
<HEAD>
<TITLE>The 'gdef' 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=530 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>The Glyph Definition Table</H2>

<P>The Glyph Definition (GDEF) table contains three types of information in three independent tables: 

<UL>
<LI>The <STRONG>GlyphClassDef</STRONG> table classifies the different types of glyphs in the font.
<LI>The <STRONG>AttachmentList</STRONG> table identifies all attachment points on the glyphs, which streamlines data access and bitmap caching.
<LI>The <STRONG>LigatureCaretList</STRONG> table contains positioning data for ligature carets, which the text-processing client uses on screen to select and highlight the individual components of a ligature glyph.
</UL>

<P>Both the GSUB and GPOS tables reference the GDEF table information to supplement their own data for substituting and positioning glyphs. Even so, a GDEF table is optional for a font, included at the discretion of the font developer. Without a GDEF table, however, the text-processing client may have to define and maintain the GDEF information on its own when substituting and positioning glyphs.

<H3>Overview</H3>

<P>A client may use any one or more of the three GDEF tables during text processing. This overview explains how each of the three tables are organized and used (See Figure 7a). The rest of this chapter describes the individual GDEF tables and the tables that they reference.

<IMG WIDTH=555 HEIGHT=238 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig7a.gif">
<STRONG>Figure 7a. High-level organization of GDEF table</STRONG><BR>

<H4>Glyph Class Definition Table</H4>
The Glyph Class Definition (GlyphClassDef) table identifies four types of glyphs in a font: simple glyphs, ligature glyphs, combining mark glyphs, and glyph components (see Figure 7b). GSUB and GPOS lookups define and use these glyph classes to differentiate the types of glyphs in a string. For example, GPOS uses the glyph classes to distinguish between a simple base glyph and the mark glyph that follows it.<BR>

<IMG WIDTH=322 HEIGHT=58 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig7b.gif"><BR>
<STRONG>Figure 7b. A simple glyph, ligature glyph, mark glyph, and glyph components</STRONG><BR>

<P>In addition, a client uses class definitions to apply GSUB and GPOS LookupFlag data correctly. For example, a LookupFlag may specify ignoring ligatures and marks during a glyph operation. If the font does not include a GlyphClassDef table, the client must define and maintain this information when using the GSUB and GPOS tables.

<H4>Attachment Point List Table</H4>

<P>The Attachment Point List table (AttachmentList) identifies all the attachment points defined in the GPOS table and their associated glyphs so a client can quickly access coordinates for each glyph's attachment points. As a result, the client can cache coordinates for attachment points along with glyph bitmaps and avoid recalculating the attachment points each time it displays a glyph. Without this table, processing speed would be slower because the client would have to decode the GPOS lookups that define attachment points and compile the points in a list.

<H4>Ligature Caret List Table</H4>

<P>The Ligature Caret List table (LigatureCaretList), particularly useful in Arabic and other scripts with many ligatures, specifies coordinates for positioning carets on all ligatures in a font. The client uses this data to select and highlight ligature components in displayed text (see Figure 7c).
<BR><IMG WIDTH=143 HEIGHT=48 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig7c.gif"><BR>
<STRONG>Figure 7c. Proper ligature caret postioning</STRONG><BR>
<P>Each ligature can have more than one caret position, with each position defined as an X or Y value on the baseline according to the writing direction of the script or language system. The font developer can use any of three formats to represent a caret coordinate value. One format represents values in design units only, another fine-tunes a value based on a designated contour point, and the third uses a Device table to adjust values at specific font sizes.

<P>Without a Ligature Caret List table, the client would have to define caret positions without knowing the positions of the ligature components. The resulting highlighting or hit-testing might be ambiguous. For example, suppose a client places a caret at the midpoint position along the width of a hyphothetical &quot;wi&quot; ligature. Because the &quot;w&quot; is wider than the &quot;i,&quot; that position would not clearly indicate which component is selected. Instead, for accurate selection, the caret should be moved to the right so that either the &quot;w&quot; or &quot;i&quot; could be clearly highlighted.

<H3>GDEF Header</H3>
<P>The GDEF table begins with a header that consists of a version number (Version), initially set to 0x00010000, an offset to a table defining the types of glyphs in the font (GlyphClassDef), an offset to a list defining attachment points on the glyphs(AttachList), and an offset to a ligature caret list (LigCaretList).

<P>Example 1 at the end of this chapter shows a GDEF Header table.

<BR>&nbsp;<BR><FONT SIZE=5>GDEF Header</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>fixed32</TD><TD VALIGN=TOP>Version</TD><TD>Version of the GDEF table-initially 0x00010000</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>GlyphClassDef</TD><TD>Offset to class definition table for glyph type-from beginning of GDEF header</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>AttachList</TD><TD>Offset to list of glyphs with attachment points-from beginning of GDEF header</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>LigCaretList</TD><TD>Offset to list of positioning points for ligature carets-from beginning of GDEF header</TD></TR>
</TABLE>&nbsp;&nbsp;

<H3>Glyph Class Definition Table</H3>
<P>The GSUB and GPOS tables use the Glyph Class Definition table (GlyphClassDef) to identify which glyph classes to adjust with lookups.

<P>The table uses the same format as the Class Definition table (for details, see the chapter, Common Table Formats). However, the GlyphClassDef table uses class values already defined in the GlyphClassDef Enumeration list:

<BR>&nbsp;<BR><FONT SIZE=5>GlyphClassDef Enumeration List</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Class</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>Simple glyph (single character, spacing glyph)</TD></TR>
<TR><TD VALIGN=TOP>2</TD><TD VALIGN=TOP>Ligature glyph (multiple character, spacing glyph)</TD></TR>
<TR><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>Mark glyph (non-spacing combining glyph)</TD></TR>
<TR><TD VALIGN=TOP>4</TD><TD VALIGN=TOP>Component glyph (part of single character, spacing glyph)</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<P>The font developer does not have to classify every glyph in the font, but any glyph not assigned a class value falls into Class zero (0). For instance, class values might be useful for the Arabic glyphs in a font, but not for the Latin glyphs. Then the GlyphClassDef table will list only Arabic glyphs, and-by default-the Latin glyphs will be assigned to Class 0. 

<P>Example 2 at the end of this chapter defines a GlyphClassDef table with a sample glyph for each of the assigned classes.

<H3>Attachment List Table</H3>
<P>The Attachment List table (AttachList) may be used to cache attachment point coordinates along with glyph bitmaps. 

<P>The table consists of an offset to a Coverage table (Coverage) listing all glyphs that define attachment points in the GPOS table, a count of the glyphs with attachment points (GlyphCount), and an array of offsets to AttachPoint tables (AttachPoint). The array lists the AttachPoint tables, one for each glyph in the Coverage table, in the same order as the 
Coverage Index.

<BR>&nbsp;<BR><FONT SIZE=5>AttachList table</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>Coverage</TD><TD>Offset to Coverage table - from beginning of AttachList table</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>GlyphCount</TD><TD>Number of glyphs with attachment points</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>AttachPoint[GlyphCount]</TD><TD>Array of offsets to AttachPoint tables-from beginning of AttachList table-in Coverage Index order</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<P>An AttachPoint table consists of a count of the attachment points on a single glyph (PointCount) and an array of contour indices of those points (PointIndex), listed in increasing numerical order.

<P>Example 3 at the end of the chapter demonstrates an AttachList table that defines attachment points for two glyphs.

<BR>&nbsp;<BR><FONT SIZE=5>AttachPoint table</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>PointCount</TD><TD>Number of attachment points on this glyph</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>PointIndex[PointCount]</TD><TD>Array of contour point indices -in increasing numerical order</TD></TR>
</TABLE>&nbsp;&nbsp;

<H3>Ligature Caret List Table</H3>

<P>The Ligature Caret List table (LigCaretList) defines caret positions for all the ligatures in a font. The table consists of an offset to a Coverage table that lists all the ligature glyphs (Coverage), a count of the defined ligatures (LigGlyphCount), and an array of offsets to LigGlyph tables (LigGlyph). The array lists the LigGlyph tables, one for each ligature in the Coverage table, in the same order as the Coverage Index.
<P>Example 4 at the end of this chapter shows a LigCaretList table.

<BR>&nbsp;<BR><FONT SIZE=5>LigCaretList table</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>Coverage</TD><TD>Offset to Coverage table - from beginning of LigCaretList table</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>LigGlyphCount</TD><TD>Number of ligature glyphs</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>LigGlyph[LigGlyphCount]</TD><TD>Array of offsets to LigGlyph tables-from beginning of LigCaretList table-in Coverage Index order</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<H4>Ligature Glyph Table</H4>
<P>A Ligature Glyph table (LigGlyph) contains the caret coordinates for a single ligature glyph. The number of coordinate values, each defined in a separate CaretValue table, equals the number of components in the ligature minus one (1). 

<P>The LigGlyph table consists of a count of the number of CaretValue tables defined for the ligature (CaretCount) and an array of offsets to CaretValue tables (CaretValue).

<P>Example 4 at the end of the chapter shows a LigGlyph table.

<BR>&nbsp;<BR><FONT SIZE=5>LigGlyph table</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>CaretCount</TD><TD>Number of CaretValues for this ligature (components - 1)</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>CaretValue[CaretCount]</TD><TD>Array of offsets to CaretValue tables-from beginning of LigGlyph table-in increasing coordinate order</TD></TR>
</TABLE>&nbsp;&nbsp;

<H4>Caret Values Table</H4>
<P>A Caret Values table (CaretValues), which defines caret positions for a ligature, can be any of three possible formats. One format uses design units to define the caret position. The other two formats use a contour point or Device table to fine-tune a caret's position at specific font sizes and device resolutions. Caret coordinates are either X or Y values, depending upon the text direction.

<H4>CaretValue Format 1</H4>
<P>The first format (CaretValueFormat1) consists of a format identifier (CaretValueFormat), followed by a single coordinate for the caret position (Coordinate). The Coordinate is in design units. 

<P>This format has the benefits of small size and simplicity, but the Coordinate value cannot be hinted for fine adjustments at different device resolutions. 

<P>Exampel 4 at the end of this chapter shows a CaretValueFormat1 table.

<BR>&nbsp;<BR><FONT SIZE=5>CaretValueFormat1 table: Design units only</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>CaretValueFormat</TD><TD>Format identifier-format = 1</TD></TR>
<TR><TD VALIGN=TOP>int16</TD><TD VALIGN=TOP>Coordinate</TD><TD>X or Y value, in design units</TD></TR>
</TABLE>&nbsp;&nbsp;

<H4>CaretValue Format 2</H4>
<P>The second format (CaretValueFormat2) specifies the caret coordinate in terms of a contour point index on a specific glyph. During font hinting, the contour point on the glyph outline may move. The point's final position after hinting provides the final value for rendering a given font size.

<P>The table contains a format identifier (CaretValueFormat) and a contour point index (CaretValuePoint).
<P>Example 5 at the end of this chapter demonstrates a CaretValueFormat2 table.

<BR>&nbsp;<BR><FONT SIZE=5>CaretValueFormat2 table: Contour point</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Name</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>

⌨️ 快捷键说明

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