📄 chapter2.htm
字号:
<HTML>
<HEAD>
<TITLE>Welcome to TrueType Open</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="DIAGRAM" SRC="/TRUETYPE/OTSPEC/pixel.gif" BORDER=0></TD>
<TD><H1>Table Formats</H1></TD>
</TR>
<TR><TD></TD><TD ALIGN=TOP>
<H2>2 Common Table Formats</H2>
<P>TrueType Open consists of five tables: the Glyph Substitution table (GSUB), the Glyph Positioning table (GPOS), the Baseline table (BASE), the Justification table (JSTF), and the Glyph Definition table (GDEF). These tables use some of the same data formats.
<P>This chapter explains the conventions used in all TrueType Open tables, and it describes the common table formats. Separate chapters provide complete details about the GSUB, GPOS, BASE, JSTF, and GDEF tables.
<H2>Overview</H2>
<P>The TrueType Open tables provide typographic information for properly positioning and substituting glyphs, operations that are required for accurate typography in many language environments. TrueType Open data is organized by script, language system, typographic feature, and lookup.
<P>Scripts are defined at the top level. A <CITE>script</CITE> is a collection of glyphs used to represent one or more languages in written form (see Figure 2a). For instance, a single script-Latin-is used to write English, French, German, and many other languages. In contrast, three scripts-Hiragana, Katakana, and Kanji-are used to write Japanese. With TrueType Open, multiple scripts may be supported by a single font.<BR>
<IMG WIDTH=172 HEIGHT=53 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig2a.gif"><BR>
<STRONG>Figure 2a. Glyphs in the Latin, Kanji, and Arabic scripts</STRONG>
<P>A <CITE>language system</CITE> may modify the functions or appearance of glyphs in a script to represent a particular language. For example, the eszet ligature is used in the German language system, but not in French or English (see Figure 2b). And the Arabic script contains different glyphs for writing the Farsi and Urdu languages. In TrueType Open, language systems are defined within scripts.<BR>
<IMG WIDTH=316 HEIGHT=152 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig2b.gif"><BR>
<STRONG>Figure 2b. Differences in the English, French, and German language systems</STRONG>
<P>A language system defines <CITE>features</CITE>, which are typographic rules for using glyphs to represent a language. Sample features are a "vert" feature that substitutes vertical glyphs in Japanese, a "liga" feature for using ligatures in place of separate glyphs, and a "mark" feature that positions diacritical marks with respect to base glyphs in Arabic (see Figure 2c). In the absence of language-specific rules, default language system features apply to the entire script. For instance, a default language system feature for the Arabic script substitutes initial, medial, and final glyph forms based on a glyph's position in a word.<BR>
<IMG ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig2c.gif"><BR>
<STRONG>Figure 2c. A ligature glyph feature substitutes the <etc> ligature for individual glyphs, and a mark feature positions diacritical marks above an Arabic ligature glyph.</STRONG>
<P>Features are implemented with lookup data that the text-processing client uses to substitute and position glyphs. <CITE>Lookups</CITE> describe the glyphs affected by an operation, the type of operation to be applied to these glyphs, and the resulting glyph output.
<H2>Table Organization</H2>
<P>Two TrueType Open tables, GSUB and GPOS, use the same data formats to describe the typographic functions of glyphs and the languages and scripts that they support: a ScriptList table, a FeatureList table, and a LookupList table. In GSUB, the tables define glyph substitution data. In GPOS, they define glyph positioning data. This chapter describes these common table formats.
<P>The ScriptList identifies the scripts in a font, each of which is represented by a Script table that contains script and language-system data. Language system tables reference features, which are defined in the FeatureList. Each feature table references the lookup data defined in the LookupList that describes how, when, and where to implement the feature.<BR>
<IMG WIDTH=555 HEIGHT=485 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig2d.gif"><BR>
<STRONG>Figure 2d. The relationship of scripts, language systems, features, and lookups for substitution and positioning tables</STRONG>
<BLOCKQUOTE>
<STRONG>Note:</STRONG> The data in the BASE and JSTF tables also is organized by script and language system. However, the data formats differ from those in GSUB and GPOS, and they do not include a FeatureList or LookupList. The BASE and JSTF data formats are described in the BASE and JSTF chapters.
</BLOCKQUOTE>
<P>The information used to substitute and position glyphs is defined in Lookup subtables. Each subtable supplies one type of information, depending upon whether the lookup is part of a GSUB or GPOS table. For instance, a GSUB lookup might specify the glyphs to be substituted and the context in which a substitution occurs, and a GPOS lookup might specify glyph position adjustments for kerning. TrueType Open has five types of GSUB lookups (described in the GSUB chapter) and seven types of GPOS lookups (described in the GPOS chapter).
<P>Each subtable includes a Coverage table that lists the "covered" glyphs that will result in a glyph substitution or positioning operation. The Coverage table formats are described in this chapter.
<P>Some substitution or positioning operations may apply to groups, or classes, of glyphs. GSUB and GPOS Lookup subtables use the Class Definition table to assign glyphs to classes. This chapter includes a description of the Class Definition table formats.
<P>Lookup subtables also may contain device tables, described in this chapter, to adjust scaled contour glyph coordinates for particular output sizes and resolutions. This chapter also describes the data types used in TrueType Open. Sample tables and lists that illustrate the common data formats are supplied at the end of this chapter.
<H2>Conventions</H2>
<P>Many data types, listed below, are used in the TrueType Open table formats. As with all other TrueType data types, the TrueType Open tables store multi-byte values in "Motorola order,"
with the most significant byte first.
<BR> <BR><FONT SIZE=5>Data Types</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=530 BORDER=0 CELLPADDING=3>
<THEAD>
<TR>
<TH BGCOLOR="#C0C0C0">Type</TH><TH BGCOLOR="#C0C0C0">Description</TH></TR>
</THEAD><TBODY>
<TR>
<TD VALIGN=TOP>uint8</TD><TD VALIGN=TOP>Unsigned character (length = 8 bits)</TD></TR>
<TR>
<TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>Unsigned integer (length = 16 bits)</TD></TR>
<TR>
<TD VALIGN=TOP>int16</TD><TD VALIGN=TOP>Signed integer (length = 16 bits)</TD></TR>
<TR>
<TD VALIGN=TOP>uint32</TD><TD VALIGN=TOP>Unsigned long integer (length = 32 bits)</TD></TR>
<TR>
<TD VALIGN=TOP>fixed32</TD><TD VALIGN=TOP>Fixed point 16.16 number(length = 32 bits)</TD></TR>
<TR>
<TD VALIGN=TOP>Tag</TD><TD VALIGN=TOP>Array of four uint8s (length = 32 bits)
-used to identify a script, language system, feature, or baseline</TD></TR>
<TR>
<TD VALIGN=TOP>GlyphID</TD><TD VALIGN=TOP>Glyph index number, same as uint16(length = 16 bits)</TD></TR>
<TR>
<TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>Offset to a table, same as uint16 (length = 16 bits)-NULL offset = 0x0000</TD></TR>
</TABLE>
<H2>Scripts and Languages</H2>
<P>Three tables and their associated records apply to scripts and languages: the Script List table (ScriptList) and its script record (ScriptRecord), the Script table and its language system record (LangSysRecord), and the Language System table (LangSys).
<H3>Script List Table and Script Record</H3>
<P>TrueType Open fonts may contain one or more groups of glyphs used to render various scripts, which are enumerated in a ScriptList table. Both the GSUB and GPOS tables define Script List tables (ScriptList):
<UL>
<LI>The GSUB table uses the ScriptList table to access the glyph substitution features that apply to a script. For details, see the chapter, The Glyph Substitution Table (GSUB).
<LI>The GPOS table uses the ScriptList table to access the glyph positioning features that apply to a script. For details, see the chapter, The Glyph Positioning Table (GPOS).
</UL>
<P>A ScriptList table consists of a count of the scripts represented by the glyphs in the font (ScriptCount) and an array of records (ScriptRecord), one for each script for which the font defines script-specific features (a script without script-specific features does not need a ScriptRecord).
<P>The ScriptRecord array stores the records alphabetically by a ScriptTag that identifies the script. Each ScriptRecord consists of a ScriptTag and an offset to a Script table.
<P>Example 1 at the end of this chapter shows a ScriptList table and ScriptRecords for a Japanese font
that uses three scripts.
<BR> <BR><FONT SIZE=5>ScriptList table</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=450 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>ScriptCount</TD><TD VALIGN=TOP>Number of ScriptRecords</TD></TR>
<TR>
<TD VALIGN=TOP>struct</TD><TD VALIGN=TOP ROWSPAN=2>ScriptRecord<BR>[ScriptCount]</TD><TD VALIGN=TOP>Array of ScriptRecords<BR>-listed alphabetically by ScriptTag</TD></TR>
</TABLE>
<BR> <BR><FONT SIZE=5>ScriptRecord</FONT>
<TABLE BGCOLOR="#F0F0F0" WIDTH=450 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>Tag</TD><TD VALIGN=TOP>ScriptTag</TD><TD VALIGN=TOP>4-byte ScriptTag identifier</TD></TR>
<TR>
<TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>Script</TD><TD VALIGN=TOP>Offset to Script table-from beginning of ScriptList</TD></TR>
</TABLE>
<H3>Script Table and Language System Record</H3>
<P>A Script table identifies each language system that defines how to use the glyphs in a script for a particular language. It also references a default language system that defines how to use the script's glyphs in the absence of language-specific knowledge.
<P>A Script table begins with an offset to the Default Language System table (DefaultLangSys), which defines the set of features that regulate the default behavior of the script. Next, Language System Count (LangSysCount) defines the number of language systems (excluding the DefaultLangSys) that use the script. In addition, an array of Language System Records (LangSysRecord) defines each language system (excluding the default) with an identification tag (LangSysTag) and an offset to a Language System table (LangSys). The LangSysRecord array stores the records alphabetically by LangSysTag.
<P>If no language-specific script behavior is defined, the LangSysCount is set to zero (0), and no LangSysRecords are allocated.
<BR> <BR><FONT SIZE=5>Script 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>DefaultLangSys</TD><TD VALIGN=TOP>Offset to DefaultLangSys table-from beginning of Script table-may be NULL</TD></TR>
<TR>
<TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>LangSysCount</TD><TD VALIGN=TOP>Number of LangSysRecords for this script-excluding the DefaultLangSys</TD></TR>
<TR>
<TD VALIGN=TOP>struct</TD><TD VALIGN=TOP>LangSysRecord<BR>[LangSysCount]</TD><TD VALIGN=TOP>Array of LangSysRecords-listed alphabetically by LangSysTag</TD></TR>
</TABLE>
<BR> <BR><FONT SIZE=5>LangSysRecord</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>Tag</TD><TD VALIGN=TOP>LangSysTag</TD><TD VALIGN=TOP>4-byte LangSysTag identifier</TD></TR>
<TR>
<TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>LangSys</TD><TD VALIGN=TOP>Offset to LangSys table-from beginning of Script table</TD></TR>
</TABLE>
<H3>Language System Table</H3>
<P>The Language System table (LangSys) identifies language-system features used to render the glyphs in a script. (The LookupOrder offset is reserved for future use.)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -