📄 chapter2.htm
字号:
<P>The examples have three columns showing hex data, source, and comments.
<H3>Example 1: ScriptList Table and ScriptRecords</H3>
<P>Example 1 illustrates a ScriptList table and ScriptRecord definitions for a Japanese font with multiple scripts: Han Ideographic, Kana, and Latin. Each script has script-specific behavior.
<BR> <BR><FONT SIZE=5>Example 1</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Hex Data</TH><TH BGCOLOR="#C0C0C0">Source</TH><TH BGCOLOR="#C0C0C0">Comment</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>ScriptList</STRONG><BR>TheScriptList</TD><TD VALIGN=BOTTOM>ScriptList table definintion</TD></TR>
<TR>
<TD VALIGN=TOP>0003</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>ScriptCount<BR>ScriptRecord[0],in alphabetical order by ScriptTag</TD></TR>
<TR>
<TD VALIGN=TOP>68616E69</TD><TD VALIGN=TOP>"hani"</TD><TD VALIGN=TOP>ScriptTag, Han Ideographic script</TD></TR>
<TR>
<TD VALIGN=TOP>0014</TD><TD VALIGN=TOP>HanIScriptTable</TD><TD VALIGN=TOP>offset to Script table<BR>ScriptRecord[1]</TD></TR>
<TR>
<TD VALIGN=TOP>6B616E61</TD><TD VALIGN=TOP>"kana"</TD><TD VALIGN=TOP>ScriptTag, Hiragana and Katakana scripts</TD></TR>
<TR>
<TD VALIGN=TOP>0018</TD><TD VALIGN=TOP>KanaScriptTable</TD><TD VALIGN=TOP>offset to Script table<BR>ScriptRecord[2]</TD></TR>
<TR>
<TD VALIGN=TOP>6C61746E</TD><TD VALIGN=TOP>"latn"</TD><TD VALIGN=TOP>ScriptTag, Latin script</TD></TR>
<TR>
<TD VALIGN=TOP>001C</TD><TD VALIGN=TOP>LatinScriptTable</TD><TD VALIGN=TOP>offset to Script table
</TD></TR>
</TABLE>
<H3>Example 2: Script Table, LangSysRecord, and LangSys Table</H3>
<P>Example 2 illustrates the Script table, LangSysRecord, and LangSys table definitions for the Arabic script and the Urdu language system. The default LangSys table defines three default Arabic script features used to replace certain glyphs in words with their proper initial, medial, and final glyph forms. These contextual substitutions are invariant and occur in all language systems that use the Arabic script.
<P>Many alternative glyphs in the Arabic script have language-specific uses. For instance, the Arabic, Farsi, and Urdu language systems use different glyphs for numerals. To maintain character-set compatibility, the Unicode standard includes separate character codes for the Arabic and Farsi numeral glyphs. However, the standard uses the same character codes for Farsi and Urdu numerals, even though three of the Urdu glyphs (4, 6, and 7) differ from the Farsi glyphs. To access and display the proper glyphs for the Urdu numerals, users of the text-processing client must enter the character codes for the Farsi numerals. Then the text-processing client uses a required TrueType Open glyph substitution feature, defined in the Urdu LangSys table, to access the correct Urdu glyphs for the 4, 6, and 7 numerals.
<P>Note that the Urdu LangSys table repeats the default script features. This repetition is necessary because the Urdu language system also uses alternative glyphs in the initial, medial, and final glyph positions in words.
<BR> <BR><FONT SIZE=5>Example 2</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Hex Data</TH><TH BGCOLOR="#C0C0C0">Source</TH><TH BGCOLOR="#C0C0C0">Comments</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>Script</STRONG><BR> ArabicScriptTable</TD><TD VALIGN=BOTTOM>Script table definition</TD></TR>
<TR>
<TD VALIGN=TOP>000A</TD><TD VALIGN=TOP>DefLangSys</TD><TD VALIGN=TOP>offset to DefaultLangSys table</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>LangSysCount LangSysRecord[0], in alphabetical order by LangSysTag</TD></TR>
<TR>
<TD VALIGN=TOP>55524420</TD><TD VALIGN=TOP>"URD "</TD><TD VALIGN=TOP>LangSysTag, Urdu language</TD></TR>
<TR>
<TD VALIGN=TOP>0016</TD><TD VALIGN=TOP>UrduLangSys</TD><TD VALIGN=TOP>offset to LangSys table for Urdu<HR></TD></TR>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>LangSys</STRONG><BR>DefLangSys</TD><TD VALIGN=BOTTOM>default LangSys table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>NULL</TD><TD VALIGN=TOP>LookupOrder, reserved, null</TD></TR>
<TR>
<TD VALIGN=TOP>FFFF</TD><TD VALIGN=TOP>0xFFFF</TD><TD VALIGN=TOP>ReqFeatureIndex, no required features</TD></TR>
<TR>
<TD VALIGN=TOP>0003</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>FeatureCount</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>FeatureIndex[0], in arbitrary order<BR>"init" feature (initial glyph)</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>FeatureIndex[1], "fina" feature (final glyph)</TD></TR>
<TR>
<TD VALIGN=TOP>0002</TD><TD VALIGN=TOP>2</TD><TD VALIGN=TOP>FeatureIndex[2], for "medi" feature (medial glyph)<HR></TD></TR>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>LangSys</STRONG><BR>UrduLangSys</TD><TD VALIGN=BOTTOM>LangSys table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>NULL</TD><TD VALIGN=TOP>LookupOrder, reserved, null</TD></TR>
<TR>
<TD VALIGN=TOP>0003</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>ReqFeatureIndex, numeral subsitution in Urdu</TD></TR>
<TR>
<TD VALIGN=TOP>0003</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>FeatureCount</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>FeatureIndex[0], in arbitrary order<BR> "init" feature (initial glyph)</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>FeatureIndex[1], "fina" feature (final glyph)</TD></TR>
<TR>
<TD VALIGN=TOP>0002</TD><TD VALIGN=TOP>2</TD><TD VALIGN=TOP> FeatureIndex[2], "medi" feature (medial glyph)</TD></TR>
</TABLE>
<H3>Example 3: FeatureList Table and Feature Table</H3>
<P>Example 3 shows the FeatureList and Feature table definitions for ligatures in the Latin script. The FeatureList has three features, all optional and named "liga." One feature, also a default, implements ligatures in Latin if no language-specific feature specifies other ligatures. Two other features implement ligatures in the Turkish and German languages, respectively.
<P>Three lookups define glyph substitutions for rendering ligatures in this font. The first lookup produces the "ffl," "fl," and "ff" ligatures; the second produces the "ffi" and "fi" ligatures; and the third produces the eszet ligature.
<P>The ligatures that begin with an "f" are separated into two sets because Turkish has a dotless "i" glyph and so does not use "ffi" and "fi" ligatures. However, Turkish does use the "ffl," "fl," and "ff" ligatures, and the TurkishLigatures feature table lists this one lookup.
<P>Only the German language system uses the eszet ligature, so the GermanLigatures feature table includes a lookup for rendering that ligature.
<P>Because the Latin script can use both sets of ligatures, the DefaultLigatures feature table defines two LookupList indices: one for the "ffl," "fl," and "ff" ligatures, and one for the "ffi" and "fi" ligatures. If the text-processing client selects this feature, then the font applies both lookups.
<P>Note that the TurkishLigatures and DefaultLigatures feature tables both list a LookupListIndex of zero (0) for the "ffl," "fl," and "ff" ligatures lookup. This is because language-specific lookups override all default language-system lookups, and a language-system feature table must explicitly list all lookups that apply to the language.
<BR> <BR><FONT SIZE=5>Example 3</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Hex Data</TH><TH BGCOLOR="#C0C0C0">Source</TH><TH BGCOLOR="#C0C0C0">Comments</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>FeatureList</STRONG><BR>TheFeatureList</TD><TD VALIGN=BOTTOM>FeatureList table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0003</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>FeatureCount<BR>FeatureRecord[0]</TD></TR>
<TR>
<TD VALIGN=TOP>6C696761</TD><TD VALIGN=TOP>"liga"</TD><TD VALIGN=TOP>FeatureTag</TD></TR>
<TR>
<TD VALIGN=TOP>0014</TD><TD VALIGN=TOP>TurkishLigatures</TD><TD VALIGN=TOP>offset to Feature table, FflFfFlLigaFeatureRecord[1]</TD></TR>
<TR>
<TD VALIGN=TOP>6C696761</TD><TD VALIGN=TOP>"liga"</TD><TD VALIGN=TOP>FeatureTag</TD></TR>
<TR>
<TD VALIGN=TOP>001A</TD><TD VALIGN=TOP>DefaultLigatures</TD><TD VALIGN=TOP>offset to Feature table, FfiFiLiga, FflFfFlLiga<BR>FeatureRecord[2]</TD></TR>
<TR>
<TD VALIGN=TOP>6C696761</TD><TD VALIGN=TOP>"liga"</TD><TD VALIGN=TOP>FeatureTag</TD></TR>
<TR>
<TD VALIGN=TOP>0022</TD><TD VALIGN=TOP>GermanLigatures</TD><TD VALIGN=TOP>offset to Feature table, EszetLiga<HR></TD></TR>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>Feature</STRONG><BR>TurkishLigatures</TD><TD VALIGN=TOP>Feature table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>NULL</TD><TD VALIGN=TOP>FeatureParams, reserved, null</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>LookupCount</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>LookupListIndex[0], ffl, fl, ff ligature substitution Lookup<HR></TD></TR>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>Feature</STRONG><BR>DefaultLigatures</TD><TD VALIGN=TOP>Feature table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>NULL</TD><TD VALIGN=TOP>FeatureParams - reserved, null</TD></TR>
<TR>
<TD VALIGN=TOP>0002</TD><TD VALIGN=TOP>2</TD><TD VALIGN=TOP>LookupCount</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>LookupListIndex[0], in arbitrary order,<BR>ffl, fl, ff ligatures</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>LookupListIndex[1], ffi, fi ligature substitution Lookup<HR></TD></TR>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>Feature</STRONG><BR>GermanLigatures</TD><TD VALIGN=BOTTOM>Feature table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>NULL</TD><TD VALIGN=TOP>FeatureParams - reserved, null</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>LookupCount</TD></TR>
<TR>
<TD VALIGN=TOP>0000</TD><TD VALIGN=TOP>0</TD><TD VALIGN=TOP>LookupListIndex[0], in arbitrary order,<BR> ffl, fl, ff ligatures</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>LookupListIndex[1], ffi, fi ligature substitution Lookup</TD></TR>
<TR>
<TD VALIGN=TOP>0002</TD><TD VALIGN=TOP>2</TD><TD VALIGN=TOP>LookupListIndex[0], eszet ligature substitution Lookup</TD></TR>
</TABLE>
<H3>Example 4: LookupList Table and Lookup Table</H3>
<P>A continuation of Example 3, Example 4 shows three ligature lookups in the LookupList table. The first generates the "ffl," "fl," and "ff" ligatures; the second produces the "ffi" and "fi" ligatures; and the third generates the eszet ligature. Each lookup table defines an offset to a subtable that contains data for the ligature substitution.
<BR> <BR><FONT SIZE=5>Example 4</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Hex Data</TH><TH BGCOLOR="#C0C0C0">Source</TH><TH BGCOLOR="#C0C0C0">Comments</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>LookupList</STRONG><BR>TheLookupList</TD><TD VALIGN=BOTTOM>LookupList table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0003</TD><TD VALIGN=TOP>3</TD><TD VALIGN=TOP>LookupCount</TD></TR>
<TR>
<TD VALIGN=TOP>0008</TD><TD VALIGN=TOP>FflFlFfLookup</TD><TD VALIGN=TOP>offset to Lookup[0] table, in design order</TD></TR>
<TR>
<TD VALIGN=TOP>0010</TD><TD VALIGN=TOP>FfiFiLookup</TD><TD VALIGN=TOP>offset to Lookup[1] table</TD></TR>
<TR>
<TD VALIGN=TOP>0018</TD><TD VALIGN=TOP>EszetLookup</TD><TD VALIGN=BOTTOM>offset to Lookup[2] table<HR></TD></TR>
<TR>
<TD VALIGN=TOP> </TD><TD VALIGN=TOP><STRONG>Lookup</STRONG><BR>FflFlFfLookup</TD><TD VALIGN=BOTTOM>Lookup[0] table definition</TD></TR>
<TR>
<TD VALIGN=TOP>0004</TD><TD VALIGN=TOP>4</TD><TD VALIGN=TOP>LookupType, ligature subst</TD></TR>
<TR>
<TD VALIGN=TOP>000C</TD><TD VALIGN=TOP>0x000C</TD><TD VALIGN=TOP>LookupFlag, IgnoreLigatures, IgnoreMarks</TD></TR>
<TR>
<TD VALIGN=TOP>0001</TD><TD VALIGN=TOP>1</TD><TD VALIGN=TOP>SubTableCount</TD></TR>
<TR>
<TD VALIGN=TOP>0018</TD><TD VALIGN=TOP>FflFlFfSubtable</TD><TD VALIGN=TOP>offset to FflFlFf ligature substitution subtable</TD></TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -