📄 jstf.htm
字号:
<HTML>
<HEAD>
<TITLE>The 'JSTF' 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>The Justification Table(JSFT)</H2>
<P>The Justification table (JSTF) provides font developers with additional control over glyph substitution and positioning in justified text. Text-processing clients now have more options to expand or shrink word and glyph spacing so text fills the specified line length.
<H3>Overview</H3>
<P>When justifying text, the text-processing client distributes the characters in each line to completely fill the specified line length. Whether removing space to fit more characters in the line or adding more space to spread the characters, justification can produce large gaps between words, cramped or extended glyph spacing, uneven line break patterns, and other jarring visual effects. For example:<BR>
<IMG WIDTH=410 HEIGHT=120 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig6a.gif"><BR>
<STRONG>Figure 6a. Poorly justified text</STRONG>
<P>To offset these effects, text-processing clients have used justification algorithms that redistribute the space with a series of glyph spacing adjustments that progress from least to most obvious. Typically, the client will begin by expanding or compressing the space between words. If these changes aren't enough or look distracting, the client might hyphenate the word at the end of the line or adjust the space between glyphs in one or more lines.
<P>To disguise spacing inconsistencies so they won't disrupt the flow of text for a reader, the font developer can use the JSTF table to enable or disable individual glyph substitution and positioning actions that apply to specific scripts, language systems, and glyphs in the font.
<P>For instance, a ligature glyph can replace multiple glyphs, shortening the line of text with an unobtrusive, localized adjustment (see Figure 6b). Font-specific positioning changes can be applied to particular glyphs in a text line that combines two or more fonts. Other options include repositioning the individual glyphs in the line, expanding the space between specific pairs of glyphs, and decreasing the spacing within particular glyph sequences.<BR>
<IMG WIDTH=448 HEIGHT=99 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig6b.gif"><BR>
<STRONG>Figure 6b. JSTF shortens the top line of this example by using the "ffi" ligature</STRONG>
<P>The font designer or developer defines JSTF data as prioritized suggestions. Each suggestion lists the particular actions that the client can use to adjust the line of text. Justification actions may apply to both vertical and horizonal text.
<H3>Table Organization</H3>
<P>The JSTF table organizes data by script and language system, as do the GSUB and GPOS tables. The JSTF table begins with a header that lists scripts in an array of JstfScriptRecords (see Figure 6c). Each record contains a ScriptTag and an offset to a JstfScript table that contains script and language-specific data:
<UL>
<LI>A default justification language system table (DefJstfLangSys) defines script-specific data that applies to the entire script in the absence of any language-specific information.
<LI>A justification language system table (JstfLangSys) stores the justification data for each language system.
</UL>
<IMG WIDTH=555 HEIGHT=356 ALT="DIAGRAM" SRC="/TRUETYPE/OTSPEC/fig6c.gif">
<STRONG>Figure 6c. High-level organization of JSTF table</STRONG>
<P>A JstfLangSys table contains a list of justification suggestions. Each suggestion consists of a list of GSUB or GPOS LookupList indices to lookups that may be enabled or disabled to add or remove space in the line of text. In addition, each suggestion can include a set of dedicated justification lookups with maximum adjustment values to extend or shrink the amount of space.
<P>The font developer prioritizes suggestions based on how they affect the appearance and function of the text line, and the client applies the suggestions in that order. Low-numbered (high-priority) suggestions correspond to "least bad" options.
<P>Each script also may supply a list of extender glyphs, such as kashidas in Arabic. A client may use the extender glyphs in addition to the justification suggestions.
<P>A client begins justifying a line of text only after implementing all selected GSUB and GPOS features for the string. Starting with the lowest-numbered suggestion, the client enables or disables the lookups specified in the JSTF table, reassembles the lookups in the LookupList order, and applies them to each glyph in the string one after another. If the line still is not the correct length, the client processes the next suggestion in ascending order of priority. This continues until the line length meets the justification requirements.
<BLOCKQUOTE>
<STRONG>Note:</STRONG> If any JSTF suggestion at any priority level modifies a GSUB or GPOS lookup that was previously applied to the glyph string, then the text processing client must apply the JSTF suggestion to an unmodified version of the glyph string.
</BLOCKQUOTE>
<P>The rest of this chapter describes the tables and records used by the JSTF table for scripts and language systems:
<UL>
<LI>Script information includes the JstfScript table (plus its associated JstfLangSysRecords) and the ExtenderGlyph table.
<LI>Language system information includes the JstfLangSys table, JstfPriority table (and its associated JstfDataRecord), the JstfModList table, and the JstfMax table.
</UL>
<H3>JSTF Header</H3>
<P>The JSTF table begins with a header that contains a version number for the table (Version), a count of the number of scripts used in the font (JstfScriptCount), and an array of records (JstfScriptRecord). Each record contains a script tag (JstfScriptTag) and an offset to a JstfScript table (JstfScript).
<BLOCKQUOTE>
<STRONG>Note:</STRONG> The JstfScriptTags must correspond with the ScriptTags listed in the GSUB and GPOS tables.</BLOCKQUOTE>
<P>Example 1 at the end of this chapter shows a JSTF Header table and JstfScriptRecord.
<BR> <BR><FONT SIZE=5>JSTF header</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>fixed32</TD><TD VALIGN=TOP>Version</TD><TD>Version of the JSTF table-initially set to 0x00010000</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>JstfScriptCount</TD><TD>Number of JstfScriptRecords in this table</TD></TR>
<TR><TD VALIGN=TOP>struct</TD><TD VALIGN=TOP>JstfScriptRecord[JstfScriptCount]</TD><TD>Array of JstfScriptRecords-in alphabetical order, by JstfScriptTag</TD></TR>
</TABLE>
<BR> <BR><FONT SIZE=5>JstfScriptRecord</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>Tag</TD><TD VALIGN=TOP>JstfScriptTag</TD><TD>4-byte JstfScript identification</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>JstfScript</TD><TD>Offset to JstfScript table-from beginning of JSTF Header</TD></TR>
</TABLE>
<H3>Justification Script Table</H3>
<P>A Justification Script (JstfScript) table describes the justification information for a single script. It consists of an offset to a table that defines extender glyphs (ExtenderGlyph), an offset to a default justification table for the script (DefJstfLangSys), and a count of the language systems that define justification data (JstfLangSysCount).
<P>If a script uses the same justification information for all language systems, the font developer defines only the DefJstfLangSys table and sets the JstfLangSysCount to zero (0). However, if any language system has unique justification suggestions, JstfLangSysCount will be a positive value, and the JstfScript table must include an array of records (JstfLangSysRecord), one for each language system. Each JstfLangSysRecord contains a language system tag (JstfLangSysTag) and an offset to a justification language system table (JstfLangSys). In the JstfLangSysRecord array, records are ordered alphabetically by JstfLangSysTag.
<BLOCKQUOTE>
<STRONG>Note:</STRONG> No JstfLangSysRecord is defined for the default script data; the data is stored in the DefJstfLangSys table instead.
</BLOCKQUOTE>
Example 2 at the end of the chapter shows a JstfScript table for the Arabic script and a JstfLangSysRecord for the Farsi language system.
<BR> <BR><FONT SIZE=5>JstfScript 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>Offset</TD><TD VALIGN=TOP>ExtenderGlyph</TD><TD>Offset to ExtenderGlyph table-from beginning of JstfScript table-may be NULL</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>DefJstfLangSys</TD><TD>Offset to Default JstfLangSys table-from beginning of JstfScript table-may be NULL</TD></TR>
<TR><TD VALIGN=TOP>uint16</TD><TD VALIGN=TOP>JstfLangSysCount</TD><TD>Number of JstfLangSysRecords in this table- may be zero (0)</TD></TR>
<TR><TD VALIGN=TOP>struct</TD><TD VALIGN=TOP>JstfLangSysRecord<BR>[JstfLangSysCount]</TD><TD>Array of JstfLangSysRecords-in alphabetical order, by JstfLangSysTag</TD></TR>
</TABLE>
<BR> <BR><FONT SIZE=5>JstfLangSysRecord</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>Tag</TD><TD VALIGN=TOP>JstfLangSysTag</TD><TD>4-byte JstfLangSys identifier</TD></TR>
<TR><TD VALIGN=TOP>Offset</TD><TD VALIGN=TOP>JstfLangSys</TD><TD>Offset to JstfLangSys table-from beginning of JstfScript table</TD></TR>
</TABLE>
<H3>Extender Glyph Table</H3>
<P>The Extender Glyph table (ExtenderGlyph) lists indices of glyphs, such as Arabic kashidas, that a client may insert to extend the length of the line for justification. The table consists of a count of the extender glyphs for the script (GlyphCount) and an array of extender glyph indices (ExtenderGlyph), arranged in increasing numerical order.
<P>Example 2 at the end of this chapter shows an ExtenderGlyph table for Arabic kashida glyphs.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -