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

📄 gsub.htm

📁 TrueType字库标准文档
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<A NAME=SSF1><H4>Single Substitution Format 1</H4></A>

<P>Format 1 calculates the indices of the output glyphs, which are not explicitly defined in the subtable. To calculate an output glyph index, Format 1 adds a constant delta value to the input glyph index. For the substitutions to occur properly, the glyph indices in the input and output ranges must be in the same order. This format does not use the Coverage Index that is returned from the Coverage table.

<P>The SingleSubstFormat1 subtable begins with a format identifier (SubstFormat) of 1. An offset references a Coverage table that specifies the indices of the input glyphs. DeltaGlyphID is the constant value added to each input glyph index to calculate the index of the corresponding output glyph.

<A HREF="#EX2"><P>Example 2</A> at the end of this chapter uses Format 1 to replace standard numerals with lining numerals.


<BR>&nbsp;<BR><FONT SIZE=5>SingleSubstFormat1 subtable:<BR> Calculated output glyph indices</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=480 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>SubstFormat</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 Substitution table</TD></TR>
<TR><TD VALIGN=TOP>int16</TD><TD VALIGN=TOP>DeltaGlyphID</TD><TD>Add to original GlyphID to get substitute GlyphID</TD></TR>
</TABLE>&nbsp;&nbsp;&nbsp;&nbsp;
	
<A NAME=SSF2><H4>Single Substitution Format 2</H4></A>

<P>Format 2 is more flexible than Format 1, but requires more space. It provides an array of output glyph indices (Substitute) explicitly matched to the input glyph indices specified in the Coverage table.

<P>The SingleSubstFormat2 subtable specifies a format identifier (SubstFormat), an offset to a Coverage table that defines the input glyph indices, a count of output glyph indices in the Substitute array (GlyphCount), and a list of the output glyph indices in the Substitute array (Substitute). 

<P>The Substitute array must contain the same number of glyph indices as the Coverage table. To locate the corresponding output glyph index in the Substitute array, this format uses the Coverage Index returned from the Coverage table.

<A HREF="#EX3"><P>Example 3</A> at the end of this chapter uses Format 2 to substitute vertically oriented glyphs for horizontally oriented glyphs.



<BR>&nbsp;<BR><FONT SIZE=5>SingleSubstFormat2 subtable:<BR> Specified output glyph indices</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=480 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>SubstFormat</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 Substitution table</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>GlyphCount</TD><TD>Number of GlyphIDs in the Substitute array</TD></TR>
<TR><TD VALIGN=TOP>GlyphID</TD><TD VALIGN=TOP>Substitute<BR>[GlyphCount]</TD><TD VALIGN=TOP>Array of substitute GlyphIDs-ordered by Coverage Index</TD></TR>
</TABLE>&nbsp;&nbsp;&nbsp;&nbsp;
	
<A NAME=MSF1><H4>LookupType 2:<BR> 
Multiple Substitution Subtable</H4></A>

<P>A Multiple Substitution (MultipleSubst) subtable replaces a single glyph with more than one glyph, as when multiple glyphs replace a single ligature. The subtable has a single format: MultipleSubstFormat1. The subtable specifies a format identifier (SubstFormat), an offset to a Coverage table that defines the input glyph indices, a count of offsets in the Sequence array (SequenceCount), and an array of offsets to Sequence tables that define the output glyph indices (Sequence). The Sequence table offsets are ordered by the Coverage Index of the input glyphs.

<P>For each input glyph listed in the Coverage table, a Sequence table defines the output glyphs. Each Sequence table contains a count of the glyphs in the output glyph sequence (GlyphCount) and an array of output glyph indices (Substitute). 

<BLOCKQUOTE>
<STRONG>Note:</STRONG> The order of the output glyph indices depends on the writing direction of the text. For text written left to right, the left-most glyph will be first glyph in the sequence. Conversely, for text written right to left, the right-most glyph will be first. 
</BLOCKQUOTE>

<P>If the glyph should be deleted, the GlyphCount is set to zero, and no Substitute array is allocated.

<A HREF="#EX4"><P>Example 4</A> at the end of this chapter shows how to replace a single ligature with three glyphs.


<BR>&nbsp;<BR><FONT SIZE=5>MultipleSubstFormat1 subtable: Multiple output glyphs</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=480 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>SubstFormat</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 Substitution table</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>SequenceCount</TD><TD>Number of Sequence table offsets in the Sequence array</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>Sequence<BR>[SequenceCount]</TD><TD>Array of offsets to Sequence tables-from beginning of Substitution table-ordered by Coverage Index</TD></TR>
</TABLE>&nbsp;&nbsp;&nbsp;&nbsp;	


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

<TABLE BGCOLOR="#F0F0F0" WIDTH=480 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>GlyphCount</TD><TD>Number of GlyphIDs in the Substitute array-to indicate glyph deletion, set to zero (0)</TD></TR>
<TR><TD VALIGN=TOP>GlyphID</TD><TD VALIGN=TOP>Substitute<BR>[GlyphCount]</TD><TD VALIGN=TOP>String of GlyphIDs to substitute-ordered according to LookupFlag direction bit</TD></TR>
</TABLE>&nbsp;&nbsp;&nbsp;&nbsp;	

<A NAME=ASF1><H4>LookupType 3:<BR> 
Alternate Substitution Subtable</H4></A>

<P>An Alternate Substitution (AlternateSubst) subtable identifies any number of aesthetic alternatives from which a user can choose a glyph variant to replace the input glyph. For example, if a font contains four variants of the ampersand symbol, the cmap table will specify the index of one of the four glyphs as the default glyph index, and an AlternateSubst subtable will list the indices of the other three glyphs as alternatives. A text-processing client would then have the option of replacing the default glyph with any of the three alternatives.

<P>The subtable has one format: AlternateSubstFormat1. The subtable contains a format identifier (SubstFormat), an offset to a Coverage table containing the indices of glyphs with alternative forms (Coverage), a count of offsets to AlternateSet tables (AlternateSetCount), and an array of offsets to AlternateSet tables (AlternateSet). 

<P>For each glyph, an AlternateSet subtable contains a count of the alternative glyphs (GlyphCount) and an array of their glyph indices (Alternate). Because all the glyphs are functionally equivalent, they can be in any order in the array. 

<A HREF="#EX5"><P>Example 5</A> at the end of this chapter shows how to replace the default ampersand glyph with alternative glyphs.


<BR>&nbsp;<BR><FONT SIZE=5>AlternateSubstFormat1 subtable: Alternative output glyphs</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=480 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>SubstFormat</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 Substitution table</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>AlternateSetCount</TD><TD>Number of AlternateSet tables</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>AlternateSet<BR>[AlternateSetCount]</TD><TD>Array of offsets to AlternateSet tables-from beginning of Substitution table-ordered by Coverage Index</TD></TR>
</TABLE>&nbsp;&nbsp;&nbsp;&nbsp;



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

<TABLE BGCOLOR="#F0F0F0" WIDTH=480 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>GlyphCount</TD><TD>Number of GlyphIDs in the Alternate array</TD></TR>
<TR><TD VALIGN=TOP>GlyphID</TD><TD VALIGN=TOP>Alternate[GlyphCount]</TD><TD>Array of alternate GlyphIDs-in arbitrary order</TD></TR>
</TABLE>&nbsp;&nbsp;&nbsp;&nbsp;
	
<A NAME=LSF1><H4>LookupType 4:<BR> 
Ligature Substitution Subtable</H4></A>

<P>A Ligature Substitution (LigatureSubst) subtable identifies ligature substitutions where a single glyph replaces multiple glyphs. One LigatureSubst subtable can specify any number of ligature substitutions.

<P>The subtable uses a single format: LigatureSubstFormat1. It contains a format identifier (SubstFormat), a Coverage table offset (Coverage), a count of the ligature sets defined in this table (LigSetCount), and an array of offsets to LigatureSet tables (LigatureSet). The Coverage table specifies only the index of the first glyph component of each ligature set.

<BR>&nbsp;<BR><FONT SIZE=5>LigatureSubstFormat1 subtable:<BR> All ligature substitutions in a script</FONT>

<TABLE BGCOLOR="#F0F0F0" WIDTH=480 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>SubstFormat</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 Substitution table</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>LigSetCount</TD><TD>Number of LigatureSet tables</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>LigatureSet<BR>[LigSetCount]</TD><TD>Array of offsets to LigatureSet tables-from beginning of Substitution table-ordered by Coverage Index</TD></TR>
</TABLE>&nbsp;&nbsp;&nbsp;&nbsp;
	
<P>A LigatureSet table, one for each covered glyph, specifies all the ligature strings that begin with the covered glyph. For example, if the Coverage table lists the glyph index for a lowercase &quot;f,&quot; then a LigatureSet table will define the &quot;ffl,&quot; &quot;fl,&quot; &quot;ffi,&quot; &quot;fi,&quot; and &quot;ff&quot; ligatures. If the Coverage table also lists the glyph index for a lowercase &quot;e,&quot; then a different LigatureSet table will define the &quot;etc&quot; ligature.

<P>A LigatureSet table consists of a count of the ligatures that begin with the covered glyph (LigatureCount) and an array of offsets to Ligature tables, which define the glyphs in each ligature (Ligature). The order in the Ligature offset array defines the preference for using the ligatures. For example, if the &quot;ffl&quot; ligature is preferable to the &quot;ff&quot; ligature, then the Ligature array would list the offset to the &quot;ffl&quot; Ligature table before the offset to the &quot;ff&quot; Ligature table. 

⌨️ 快捷键说明

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