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

📄 gpos.htm

📁 TrueType字库标准文档
💻 HTM
📖 第 1 页 / 共 5 页
字号:
	
<H4>Pair Positioning Adjustment: Format 2</H4>

<P>Format 2 defines a pair as a set of two glyph classes and modifies the positions of all the glyphs in a class. For example, this format is useful in Japanese scripts that apply specific kerning operations to all glyph pairs that contain punctuation glyphs. One class would be defined as all glyphs that may be coupled with punctuation marks, and the other classes would be groups of similar punctuation glyphs.
 
<P>The PairPos Format2 subtable begins with a format identifier (PosFormat) and an offset to a Coverage table (Coverage), measured from the beginning of the PairPos subtable. The Coverage table lists the indices of the first glyphs that may appear in each glyph pair. More than one pair may begin with the same glyph, but the Coverage table lists the glyph index only once. 

<BLOCKQUOTE>
<STRONG>Note:</STRONG> The ClassDef1 table also identifies the first glyphs in each pair, but the redundant listing in the Coverage table accelerates the lookup process.
</BLOCKQUOTE>

<P>A PairPosFormat2 subtable also includes two ValueFormats:

<UL>
<LI>ValueFormat1 applies to the ValueRecord of the first glyph in each pair. The ValueRecords for all the first glyphs must use ValueFormat1.
<LI>ValueFormat2 applies to the ValueRecord of the second glyph in each pair. The ValueRecords for all of the second glyphs must use ValueFormat2.
</UL>

<P>Either of the two ValueFormats may be set to zero (0) to indicate that the corresponding glyph has no ValueRecord and, therefore, should not be repositioned.
PairPosFormat2 requires that each glyph in all pairs be assigned to a class, which is identified by an integer called a class value. (For details about classes, see the chapter, Common Table Formats.) Pairs are then represented in a two-dimensional array as sequences of two class values. Multiple pairs can be represented in one Format 2 subtable.

<P>A PairPosFormat2 subtable contains offsets to two class definition tables: one that assigns class values to all the first glyphs in all pairs (ClassDef1), and one that assigns class values to all the second glyphs in all pairs (ClassDef2). If both glyphs in a pair use the same class definition, the offset value will be the same for ClassDef1 and ClassDef2. The subtable also specifies the number of glyph classes defined in ClassDef1 (Class1Count) and in ClassDef2 (Class2Count), including Class0.

<P>For each class identified in the ClassDef1 table, a Class1Record enumerates all pairs that contain a particular class as a first component. The Class1Record array stores all Class1Records according to class value. 

<BLOCKQUOTE>
<STRONG>Note:</STRONG> Class1Records are not tagged with a class value identifier. Instead, the index value of a Class1Record in the array defines the class value represented by the record. For example, the first Class1Record enumerates pairs that begin with a Class 0 glyph, the second Class1Record enumerates pairs that begin with a Class1 glyph, and so on.
</BLOCKQUOTE>

<BR>&nbsp;<BR><FONT SIZE=5>PairPosFormat2 subtable: Class pair adjustment</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>
<TBODY>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>PosFormat</TD><TD>Format identifier-format = 2</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>Coverage</TD><TD>Offset to Coverage table-from beginning of PairPos subtable-for the first glyph of the pair</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>ValueFormat1</TD><TD>ValueRecord definition-for the first glyph of the pair-may be zero (0)</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>ValueFormat2</TD><TD>ValueRecord definition-for the second glyph of the pair-may be zero (0)</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>ClassDef1</TD><TD>Offset to ClassDef table-from beginning of PairPos subtable-for the first glyph of the pair</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>ClassDef2</TD><TD>Offset to ClassDef table-from beginning of PairPos subtable-for the second glyph of the pair</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>Class1Count</TD><TD>Number of classes in ClassDef1 table-includes Class0</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>Class2Count</TD><TD>Number of classes in ClassDef2 table-includes Class0</TD></TR>
<TR><TD VALIGN=TOP>struct</TD><TD VALIGN=TOP>Class1Record<BR>[Class1Count]</TD><TD VALIGN=TOP>Array of Class1 records-ordered by Class1</TD></TR>
</TABLE>&nbsp;&nbsp;	

<P>Each Class1Record contains an array of Class2Records (Class2Record), which also are ordered by class value. One Class2Record must be declared for each class in the ClassDef2 table, including Class 0.

<BR>&nbsp;<BR><FONT SIZE=5>Class1Record</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>
<TBODY>
<TR><TD VALIGN=TOP>struct</TD><TD VALIGN=TOP>Class2Record[Class2Count]</TD><TD>Array of Class2 records-ordered by Class2</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<P>A Class2Record consists of two ValueRecords, one for the first glyph in a class pair (Value1) and one for the second glyph (Value2). If the PairPos subtable has a value of zero (0) for ValueFormat1 or ValueFormat2, the corresponding record (ValueRecord1 or ValueRecord2) will be empty.

<P>Example 5 at the end of this chapter demonstrates pair kerning with glyph classes in a PairPosFormat2 subtable.

<BR>&nbsp;<BR><FONT SIZE=5>Class2Record</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>
<TBODY>
<TR><TD VALIGN=TOP>ValueRecord</TD><TD VALIGN=TOP>Value1</TD><TD>Positioning for first glyph-empty if ValueFormat1 = 0</TD></TR>
<TR><TD VALIGN=TOP>ValueRecord</TD><TD VALIGN=TOP>Value2</TD><TD>Positioning for second glyph-empty if ValueFormat2 = 0</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<H3>Lookup Type 3:<BR> 
Cursive Attachment Positioning Subtable</H3>

<P>Some cursive fonts are designed so that adjacent glyphs join when rendered with their default positioning. However, if positioning adjustments are needed to join the glyphs, a cursive attachment positioning (CursivePos) subtable can describe how to connect the glyphs by aligning two anchor points: the designated exit point of a glyph, and the designated entry point of the following glyph.

<P>The subtable has one format: CursivePosFormat1. It begins with a format identifier (PosFormat) and an offset to a Coverage table (Coverage), which lists all the glyphs that define cursive attachment data.

<P>In addition, the subtable contains one EntryExitRecord for each glyph listed in the Coverage table, a count of those records (EntryExitCount), and an array of those records in the same order as the Coverage Index (EntryExitRecord).

<BR>&nbsp;<BR><FONT SIZE=5>CursivePosFormat1 subtable: Cursive attachment</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>
<TBODY>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>PosFormat</TD><TD>Format identifier-format = 1</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>Coverage</TD><TD>Offset to Coverage table-from beginning of CursivePos subtable</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>EntryExitCount</TD><TD>Number of EntryExit records</TD></TR>
<TR><TD VALIGN=TOP>struct</TD><TD VALIGN=TOP>EntryExitRecord[EntryExitCount]</TD><TD>Array of EntryExit records-in Coverage Index order</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<P>Each EntryExitRecord consists of two offsets: one to an Anchor table that identifies the entry point on the glyph (EntryAnchor), and an offset to an Anchor table that identifies the exit point on the glyph (ExitAnchor). (For a complete description of the Anchor table, see the end of this chapter.) 

<P>To position glyphs using the CursivePosFormat1 subtable, a text-processing client aligns the ExitAnchor point of a glyph with the EntryAnchor point of the following glyph. If no corresponding anchor point exists, either the EntryAnchor or ExitAnchor offset may be NULL.

<P>At the end of this chapter, Example 6 describes cursive glyph attachment in the Urdu language.

<BR>&nbsp;<BR><FONT SIZE=5>EntryExitRecord</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>
<TBODY>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>EntryAnchor</TD><TD>Offset to EntryAnchor table-from beginning of CursivePos subtable-may be NULL</TD></TR>
<TR>	<TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>ExitAnchor</TD><TD>Offset to ExitAnchor table-from beginning of CursivePos subtable-may be NULL</TD></TR>
</TABLE>&nbsp;&nbsp;
	
<H3>Lookup Type 4:<BR> 
MarkToBase Attachment Positioning Subtable</H3>

<P>The MarkToBase attachment (MarkBasePos) subtable is used to position combining mark glyphs with respect to base glyphs. For example, the Arabic, Hebrew, and Thai scripts combine vowels, diacritical marks, and tone marks with base glyphs.

<P>In the MarkBasePos subtable, every mark glyph has an anchor point and is associated with a class of marks. Each base glyph then defines an anchor point for each class of marks it uses. 

<P>For example, assume two mark classes: all marks positioned above base glyphs (Class 0), and all marks positioned below base glyphs (Class 1). In this case, each base glyph that uses these marks would define two anchor points, one for attaching the mark glyphs listed in Class 0, and one for attaching the mark glyphs listed in Class 1.

<P>To identify the base glyph that combines with a mark, the text-processing client must look backward in the glyph string from the mark to the preceding base glyph. To combine the mark and base glyph, the client aligns their attachment points, positioning the mark with respect to the final pen point (advance) position of the base glyph.

<P>The MarkToBase Attachment subtable has one format: MarkBasePosFormat1. The subtable begins with a format identifier (PosFormat) and offsets to two Coverage tables: one that lists all the mark glyphs referenced in the subtable (MarkCoverage), and one that lists all the base glyphs referenced in the subtable (BaseCoverage). 

<P>For each mark glyph in the MarkCoverage table, a record specifies its class and an offset to the Anchor table that describes the mark's attachment point (MarkRecord). A mark class is identified by a specific integer, called a class value. ClassCount specifies the total number of distinct mark classes defined in all the MarkRecords. 

<P>The MarkBasePosFormat1 subtable also contains an offset to a MarkArray table, which contains all the MarkRecords stored in an array (MarkRecord) by MarkCoverage Index. A MarkArray table also contains a count of the defined MarkRecords (MarkCount). (For details about MarkArrays and MarkRecords, see the end of this chapter.)

<P>The MarkBasePosFormat1 subtable also contains an offset to a BaseArray table (BaseArray).

<BR>&nbsp;<BR><FONT SIZE=5>MarkBasePosFormat1 subtable: MarkToBase attachment point</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>
<TBODY>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>PosFormat</TD><TD>Format identifier-format = 1</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>MarkCoverage</TD><TD>Offset to MarkCoverage table-from beginning of MarkBasePos subtable</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>BaseCoverage</TD><TD>Offset to BaseCoverage table-from beginning of MarkBasePos subtable</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>ClassCount</TD><TD>Number of classes defined for marks</TD></TR>

⌨️ 快捷键说明

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