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

📄 gpos.htm

📁 TrueType字库标准文档
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<HTML>
<HEAD>
<TITLE>The 'GPOS' 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>4. The Glyph Positioning Table(GPOS)</H2>

<P>The Glyph Positioning table (GPOS) provides precise control over glyph placement for sophisticated text layout and rendering in each script and language system that a font supports. 
<h3>Overview</h3>
Complex glyph positioning becomes an issue in writing systems, such as Vietnamese, that use diacritical and other marks to modify the sound or meaning of characters. These writing systems require controlled placement of all marks in relation to one another for legibility and linguistic accuracy.<BR>

<IMG WIDTH=507 HEIGHT=56 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig4a.gif"><BR>
<STRONG>Figure 4a. Vietnamese words with marks.</STRONG>

<P>Other writing systems require sophisticated glyph positioning for correct typographic composition. For instance, Urdu glyphs are calligraphic and connect to one another along a descending, diagonal text line that proceeds from right to left. To properly render Urdu, a text-processing client must modify both the horizontal (X) and vertical (Y) positions of each glyph.<BR>

<IMG WIDTH=517 HEIGHT=79 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig4b.gif"><BR>
<STRONG>Figure 4b. Urdu layout requires glyph positioning control, as well as contextual substitution</STRONG>

<P>With the GPOS table, a font developer can define a complete set of positioning adjustment features in a TrueType Open font. GPOS data, organized by script and language system, is easy for a text-processing client to use to position glyphs.

<H3>Positioning Glyphs with TrueType 1.0</H3>

<P>Glyph positioning in TrueType 1.0 uses only two values, placement and advance, to specify a glyph's position for text layout. If glyphs are positioned with respect to a virtual &quot;pen point&quot; that moves along a line of text, placement describes the glyph's position with respect to the current pen point, and advance describes where to move the pen point to position the next glyph (see Figure 4c). For horizontal text, placement corresponds to the left side bearing, and advance corresponds to the advance width.<BR>

<IMG WIDTH=575 HEIGHT=273 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig4c.gif"><BR>
<STRONG>Figure 4c. Glyph positioning with TrueType 1.0</STRONG>

<P>TrueType 1.0 specifies placement and advance only in the X direction for horizontal layout and only in the Y direction for vertical layout. For simple Latin text layout, these two values may be adequate to position glyphs correctly. But, for texts that require more sophisticated layout, the values must cover a richer range. Placement and advance may need adjustment vertically, as well as horizontally. 

<P>The only positioning adjustment defined in TrueType 1.0 is pair kerning, which modifies the horizontal spacing between two glyphs. A typical kerning table lists pairs of glyphs and specifies how much space a text-processing client should add or remove between the glyphs to properly display each pair. It does not provide specific information about how to adjust the glyphs in each pair, and cannot adjust contexts of more than two glyphs.

<H3>Positioning Glyphs with TrueType Open</H3>

<P>TrueType Open supplies more control and flexibility for positioning a single glyph and for positioning multiple glyphs in relation to one another. By using both X and Y values that the GPOS table defines for placement and advance and by using glyph attachment points, a client can more precisely adjust the position of a glyph.

<P>To improve kerning, the GPOS table offers both horizontal and vertical values for independently adjusting each glyph in a pair. For each glyph, the table also explicitly describes the type, size, and direction of the adjustment. For example, to kern two glyphs horizontally, the table might say to reduce the total advance units of the first glyph by 20 units in the X direction, reduce the left side bearing of the second glyph by 20 units, or to do both but by 10 units instead of 20.

<P>Similarly, the GPOS table can specify adjustments to the positions of three or more glyphs. This is useful for triplet kerning or other adjustments that depend on a glyph string context. 
In addition, the GPOS table can reference a Device table to define subtle, device-dependent adjustments to any placement or advance value at any font size and device resolution. For example, a Device table can specify adjustments at 51 pixels per em (ppem) that do not occur at 50 ppem.

<P>Other GPOS features can define attachment points to combine glyphs and position them with respect to one another. A glyph might have multiple attachment points. The point used will depend on the glyph to be attached. For instance, a base glyph could have attachment points for different diacritical marks. 

<P>To reduce the size of the font file, a base glyph may use the same attachment point for all mark glyphs assigned to a particular class. For example, a base glyph could have two attachment points, one above and one below the glyph. Then all marks that attach above glyphs would be attached at the high point, and all marks that attach below glyphs would be attached at the low point. Attachment points are useful in scripts, such as Arabic, that combine numerous glyphs with vowel marks.

<P>Attachment points also are useful for connecting cursive-style glyphs. Glyphs in cursive fonts can be designed to attach or overlap when rendered. Alternatively, the font developer can use TrueType Open to create a cursive attachment feature and define explicit exit and entry attachment points for each glyph (see Figure 4d).<BR>

<IMG WIDTH=90 HEIGHT=75 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig4d.gif"><BR>
<STRONG>Figure 4d. Entry and exit points marked on contextual Urdu glyph variations</STRONG>

<P>The GPOS table supports seven types of actions for positioning and attaching glyphs:

<UL>
<LI>A <CITE>single adjustment</CITE> positions one glyph, such as a superscript or subscript.
<LI>A <CITE>pair adjustment</CITE> positions two glyphs with respect to one another. Kerning is an example of pair adjustment.
<LI>A <CITE>cursive attachment</CITE> describes cursive scripts and other glyphs that are connected with attachment points when rendered.
<LI>A <CITE>MarkToBase attachment</CITE> positions combining marks with respect to base glyphs, as when positioning vowels, diacritical marks, or tone marks in Arabic, Hebrew, and Vietnamese.
<LI>A <CITE>MarkToLigature attachment</CITE> positions combining marks with respect to ligature glyphs. Because ligatures may have multiple points for attaching marks, the font developer needs to associate each mark with one of the ligature glyph's components.
<LI>A <CITE>MarkToMark attachment</CITE> positions one mark relative to another, as when positioning tone marks with respect to vowel diacritical marks in Vietnamese.
<LI><CITE>Contextual positioning</CITE> describes how to position one or more glyphs in context, within an identifiable sequence of specific glyphs, glyph classes, or varied sets of glyphs. One or more positioning operations may be performed on &quot;input&quot; context sequences. Figure 4e illustrates a context for positioning adjustments.<BR>
</UL>

<IMG WIDTH=326 HEIGHT=57 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig4e.gif"><BR>
<STRONG>Figure 4e. Contextual positioning lowered the accent over a vowel glyph that followed an overhanging uppercase glyph</STRONG>

<H3>Table Organization</H3>

<P>The GPOS table begins with a header that defines offsets to a ScriptList, a FeatureList, and a LookupList (see Figure 4f):

<UL>
<LI>The ScriptList identifies all the scripts and language systems in the font that use glyph positioning. 
<LI>The FeatureList defines all the glyph positioning features required to render these scripts and language systems. 
<LI>The LookupList contains all the lookup data needed to implement each glyph positioning feature. 
</UL>
<P>For a detailed discussion of ScriptLists, FeatureLists, and LookupLists, see the chapter, Common Table Formats. The following discussion summarizes how the GPOS table works.<BR>

<IMG WIDTH=555 HEIGHT=556 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig4f.gif"><BR>
<STRONG>Figure 4f. High-level organization of GPOS table</STRONG>

<P>The GPOS table is organized so text processing clients can easily locate the features and lookups that apply to a particular script or language system. To access GPOS information, clients should use the following procedure:

<OL>
<LI>Locate the current script in the GPOS ScriptList table. 
<LI>If the language system is known, search the script for the correct LangSys table; otherwise, use the script's default language system (DefaultLangSys table). 
<LI>The LangSys table provides index numbers into the GPOS FeatureList table to access a required feature and a number of additional features. 
<LI>Inspect the FeatureTag of each feature, and select the features to apply to an input glyph string.
<LI>Each feature provides an array of index numbers into the GPOS LookupList table. Lookup data is defined in one or more subtables that contain information about specific glyphs and the kinds of operations to be performed on them. 
<LI>Assemble all lookups from the set of chosen features, and apply the lookups in the order given in the LookupList table. 
</OL>

<P>A lookup uses subtables to define the specific conditions, type, and results of a positioning action used to implement a feature. All subtables in a lookup must be of the same LookupType, as listed in the LookupType Enumeration table:

<BR>&nbsp;<BR><FONT SIZE=5>LookupType Enumeration table for glyph positioning</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=480 BORDER=0 CELLPADDING=3>
<THEAD>
<TR><TH BGCOLOR="#COCOCO">Value</TH><TH BGCOLOR="#COCOCO">Type</TH><TH BGCOLOR="#COCOCO">Description</TH></TR>
</THEAD>
<TBODY>
<TR><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>Single adjustment</TD><TD>Adjust position of a single glyph</TD></TR>
<TR><TD VALIGN=TOP>2</TD><TD VALIGN=TOP>Pair adjustment</TD><TD>Adjust position of a pair of glyphs</TD></TR>
<TR><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>Cursive attachment</TD><TD>Attach cursive glyphs</TD></TR>
<TR><TD VALIGN=TOP>4</TD><TD VALIGN=TOP>MarkToBase attachment</TD><TD>Attach a combining mark to a base glyph</TD></TR>
<TR><TD VALIGN=TOP>5</TD><TD VALIGN=TOP>MarkToLigature attachment</TD><TD>Attach a combining mark to a ligature</TD></TR>
<TR><TD VALIGN=TOP>6</TD><TD VALIGN=TOP>MarkToMark attachment</TD><TD>Attach a combining mark to another mark</TD></TR>
<TR><TD VALIGN=TOP>7</TD><TD VALIGN=TOP>Context positioning</TD><TD>Position one or more glyphs in context</TD></TR>
<TR><TD VALIGN=TOP>8+</TD><TD VALIGN=TOP>Reserved</TD><TD>For future use</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<P>Each LookupType is defined by one or more subtables, whose format depends on the type of positioning operation and the resulting storage efficiency. When glyph information is best presented in more than one format, a single lookup may define more than one subtable, as long as all the subtables are of the same LookupType. For example, within a given lookup, a glyph index array format may best represent one set of target glyphs, whereas a glyph index range format may be better for another set.
 
<P>A series of positioning operations on the same glyph or string requires multiple lookups, one for each separate action. Each lookup is given a different array number in the LookupList table and is applied in the LookupList order.

<P>During text processing, a client applies a lookup to each glyph in the input string, starting with the first glyph, before moving to the next lookup. To apply a lookup, the client searches the subtables in the order they are defined in the lookup. If the first subtable does not contain data relevant to the glyph, the client searches the next subtable, and so on. If the client finds glyph data, it adjusts the glyph position.

<P>A lookup is finished for a glyph when the client repositions a glyph or when the client finds no relevant data in any of the subtables defined in the lookup. The client then advances to the next glyph in the glyph string and begins the lookup process again.

<P>This rest of this chapter describes the GPOS header and the subtables defined for each LookupType. Several GPOS subtables share other tables: ValueRecords, Anchor tables, and MarkArrays. For easy reference, the shared tables are described at the end of this chapter.

<H3>GPOS Header</H3>
<P>The GPOS table begins with a header that contains a version number (Version) initially set to 1.0 (0x00010000) and offsets to three tables: ScriptList, FeatureList, and LookupList. For descriptions of these tables, see the chapter, Common Table Formats.
Example 1 at the end of this chapter shows a GPOS Header table definition.

<BR>&nbsp;<BR><FONT SIZE=5>GPOS Header</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=480 BORDER=0 CELLPADDING=3>
<THEAD> 
<TR><TH BGCOLOR="#COCOCO">Type</TH><TH BGCOLOR="#COCOCO">Name</TH><TH BGCOLOR="#COCOCO">Description</TH></TR>
</THEAD>

⌨️ 快捷键说明

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