/htdocs/gposgsub.html
HTML | 1789 lines | 1319 code | 467 blank | 3 comment | 0 complexity | d03705ac1e038ce583a27e753ea02586 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.0
Large files files are truncated, but you can click here to view the full file
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta name="generator" content=
- "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
- <!-- Created with AOLpress/2.0 -->
- <!-- AP: Created on: 29-Dec-2002 -->
- <!-- AP: Last modified: 20-Mar-2008 -->
- <title>Advanced Typography tables</title>
- <link rel="icon" href="fftype16.png" />
- <link rel="stylesheet" type="text/css" href="FontForge.css" />
- <style type="text/css">
- /*<![CDATA[*/
- h4.c4 {color: red}
- p.c3 {text-align: center}
- p.c2 {text-align: left}
- h1.c1 {text-align: center}
- /*]]>*/
- </style>
- </head>
- <body>
- <div id="in">
- <h1 class="c1">Advanced Typography Tables</h1>
- <p>These differ between OpenType (originally called TrueType
- Open) and Apple (GX or Apple Advanced Typography). My support
- for both OpenType and Apple is incomplete.</p>
- <ul>
- <li><a href="#opentype">The <b><code>GPOS</code></b>,
- <b><code>GSUB</code></b> and <b><code>GDEF</code></b>
- opentype tables</a></li>
- <li><a href="#AAT">Apple Advanced Typography</a></li>
- <li><a href="#Conversion">What features can be converted
- between OpenType and AAT?</a></li>
- <li><a href="TrueOpenTables.html">other true type and open
- type tables</a></li>
- <li><a href="#Unsupported">What is unsupported</a></li>
- <li><a href="non-standard.html">FontForge's non-standard
- extensions</a></li>
- </ul>
- <h2>The <b><code>GPOS,</code></b> <b><code>GSUB,</code></b>
- <b><code>GDEF</code></b> and <code>BASE</code> <a name=
- "opentype" id="opentype">opentype</a> tables</h2>
- <p>The first two tables are used for positioning and
- substituting glyphs. The GPOS table can control things like:
- kerning, accent positioning, cursive joining, etc. The GSUB
- table can control things like: ligatures, arabic forms,
- vertical rotation, conversion to small caps, indic glyph
- rearrangement, etc. GDEF contains some rather esoteric glyph
- information, ligature carets, etc. BASE contains information on
- baseline placement and line heights.</p>
- <p>This page assumes basic familiarity with the abilities of
- the tables, for more information on them read, study and
- inwardly digest the opentype docs on:</p>
- <ul>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_table_formats.html">
- The header for both GPOS and GSUB</a></li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_table_formats2.html">
- The GPOS table</a>, for positioning glyphs</li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_table_formats1.html">
- The GSUB table</a>, for substituting glyphs</li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_table_formats5.html">
- The GDEF table</a>, for classifying glyphs and for providing
- a ligature caret table</li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_base.html">
- The BASE table</a>, for baseline placement</li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_tag3.html">
- The list of feature tags supported by opentype</a></li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_tag1.html">
- The list of script tags supported by opentype</a></li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_tag2.html">
- The list of language tags supported by opentype</a></li>
- <li><a href=
- "http://partners.adobe.com/public/developer/opentype/index_tag4.html">
- The list of baseline tags supported by opentype</a></li>
- </ul>
- <p>The basic idea of the GPOS and GSUB tables is that each
- script (or language within a script) has a set of "features"
- that are available to it. A feature in turn is associated with
- a lookup which contains data for the feature. An example of a
- script is 'latn' for latin, 'arab' for arabic, 'hani' for
- chinese ideographs. Two examples of features are 'kern' which
- provides kerning information between pairs of glyphs and 'init'
- which will transform one set of glyphs to another when those
- glyphs are at the beginning of a word.</p>
- <p>FontForge <a href="gposgsub.html#Unsupported">does not
- support</a> the full range of possibilities inherent in these
- tables.</p>
- <h3>The <b><code><a name="GPOS" id="GPOS">GPOS</a></code></b>
- table</h3>
- <p>FontForge will read the following sub tables of the GPOS
- table:</p>
- <table border="1">
- <tr>
- <th></th>
- <th>name</th>
- <th>Reading support</th>
- <th>Writing support</th>
- </tr>
- <tr>
- <td>1</td>
- <td>single adjustment</td>
- <td>This sub-table allows the font designer to change the
- metrics of a specific glyph. The feature tag will provide a
- context in which the change should occur. For instance the
- 'tnum' (tabular numbers) feature could change a
- proportionally spaced digit by adjusting its advance width
- to be some set value and then centering the digit (by
- adjusting the left side bearing) within the new width.</td>
- <td>These can be created with the <a href=
- "charinfo.html">Element->Char Info</a>->Position
- command.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>pair adjustment</td>
- <td>This sub-table allows the font designer to change the
- metrics of a specific pair of glyph. The most common use of
- this is for kerning where the advance width of the first
- glyph is altered depending on which glyph follows it. But
- the table is more general than that and could support mark
- (accent, vowel) positioning over a base glyph (though that
- is more efficiently done with the mark to base
- subtable).</td>
- <td>'kern' feature s may be created from the <a href=
- "metricsview.html">Metrics View</a>. 'vkrn' with <a href=
- "metricsmenu.html#VKernFromHKern">Metrics->VKern From
- HKern</a>.</td>
- </tr>
- <tr>
- <td>3</td>
- <td>cursive attachment</td>
- <td>This sub-table allows the font designer to force
- adjacent glyphs to join at specific points. It can be used
- to generate the slanted script style needed for Urdu.</td>
- <td>Only the 'curs' feature is supported for this
- sub-table. These may be created with the <a href=
- "pointmenu.html#AddAnchor">Points->Add Anchor</a>
- command</td>
- </tr>
- <tr>
- <td>4</td>
- <td>mark to base</td>
- <td>This sub-table allows the font designer to specify how
- mark glyphs (accents, vowel signs, etc.) are positioned
- over base glyphs. Every glyph can have an attachment point
- and the mark's attachment point will be placed on the
- base's attachment point so the two join properly. See my
- <a href="overview.html#Anchors">example</a> in the
- overview.</td>
- <td>These may be created with the <a href=
- "pointmenu.html#AddAnchor">Points->Add Anchor</a>
- command</td>
- </tr>
- <tr>
- <td>5</td>
- <td>mark to ligature</td>
- <td>This sub-table is very similar to the previous one
- except that the base glyph is a ligature and may have
- several different points at which the same type of accent
- may be placed.</td>
- <td>These may be created with the <a href=
- "pointmenu.html#AddAnchor">Points->Add Anchor</a>
- command</td>
- </tr>
- <tr>
- <td>6</td>
- <td>mark to mark</td>
- <td>This sub-table is very similar to the previous two
- except that the base glyph is itself a mark. This may be
- used when a glyph has two accents each of which would
- normally be placed at the same attachment point on a base
- glyph. The second accent will be place relative to the
- first accent rather than to the base glyph.</td>
- <td>These may be created with the <a href=
- "pointmenu.html#AddAnchor">Points->Add Anchor</a>
- command</td>
- </tr>
- <tr>
- <td>7</td>
- <td>contextual positioning</td>
- <td>This sub-table allows the font designer to control the
- positioning of glyphs when they occur within a specific
- string (or class of strings). For instance this table could
- say "when you see a digit followed by the string "th" then
- raise the "th" into a superscript position"</td>
- <td>These may be created with the <a href=
- "lookups.html#contextual-subs">Element->Font
- Info->Contextual</a> command</td>
- </tr>
- <tr>
- <td>8</td>
- <td>chaining contextual positioning</td>
- <td>This is a slightly more complex version of the above,
- it doesn't really add new capabilities, but it does provide
- a more logical approach to the issue.</td>
- <td>These may be created with the <a href=
- "lookups.html#contextual-subs">Element->Font
- Info->Contextual</a> command</td>
- </tr>
- <tr>
- <td>9</td>
- <td>extension positioning</td>
- <td>This is used to allow for a GPOS table which is bigger
- than 64k. Its use should be quite invisible to the font
- designer</td>
- <td>FontForge uses this sub-table when needed.</td>
- </tr>
- <tr>
- <td>10+</td>
- <td>reserved for future use</td>
- <td></td>
- <td>FontForge does not support these sub-tables yet.<br />
- (nor does anyone)</td>
- </tr>
- </table>
- <p>FontForge also has built into it knowledge on how to provide
- default values for some features that use these tables. See
- <a href="elementmenu.html#DefaultATT">Element->Typo.
- Features->Default ATT</a> command for that.</p>
- <p>FontForge will retain the order of features in the GPOS
- table and when a font is generated the order should be the same
- as it was before.</p>
- <h3>The <b><code><a name="GSUB" id="GSUB">GSUB</a></code></b>
- table</h3>
- <p>FontForge will read the following sub tables of the GSUB
- table:</p>
- <table border="1">
- <tr>
- <th></th>
- <th>name</th>
- <th>Reading support</th>
- <th>Writing support</th>
- </tr>
- <tr>
- <td>1</td>
- <td>single substitution</td>
- <td>This sub-table allows the font designer to change from
- one glyph to another, with a context provided by the
- feature tag. For example many scripts have letters which
- have a different form at the end of a word than they do
- within (this is true of every letter in arabic, several in
- hebrew, lower case sigma in greek, and the long-s/short-s
- pair in renaissance latin). So the 'fina' feature would map
- the normal form into the final form, and the word
- processing program would do a lookup at the end of each
- word to see if a transformation was needed.</td>
- <td>These can be created with the <a href=
- "charinfo.html">Element->Char Info</a>->Substitution
- command.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>multiple substitution</td>
- <td>This sub-table allows the font designer to replace one
- glyph by a series of others. This is generally used for
- rather technical layout issues.</td>
- <td>These can be created with the <a href=
- "charinfo.html">Element->Char Info</a>->Multiple
- Substitution command.</td>
- </tr>
- <tr>
- <td>3</td>
- <td>alternate substitution</td>
- <td>This sub-table allows the font designer to have a
- series of "alternates" for each glyph. One common example
- would be an italic font which had several swash variants
- for each capital letter. The word processing program would
- allow the user to choose which variant was appropriate</td>
- <td>These can be created with the <a href=
- "charinfo.html">Element->Char Info</a>->Alternate
- Substitution command.</td>
- </tr>
- <tr>
- <td>4</td>
- <td>ligature substitution</td>
- <td>This sub-table allows the font designer to replace a
- string of glyphs with another glyph. A common example is a
- ligature where the string <img src="f+i.png" width="24"
- height="25" align="middle" /> is replaced by the <img src=
- "fi.png" width="20" height="25" align="middle" />
- ligature.</td>
- <td>These can be created with the <a href=
- "charinfo.html">Element->Char Info</a>->Ligature
- command.</td>
- </tr>
- <tr>
- <td>5</td>
- <td>contextual substitution</td>
- <td>This subtable allows for a string of glyphs to replace
- another string of glyphs (or class of strings of
- glyphs)</td>
- <td>These may be created with the <a href=
- "lookups.html#contextual-subs">Element->Font
- Info->Contextual</a> command</td>
- </tr>
- <tr>
- <td>6</td>
- <td>chaining contextual substitution</td>
- <td>This is a slightly more complex version of the above,
- it doesn't really add new capabilities, but it does provide
- a more logical approach to the issue.</td>
- <td>These may be created with the <a href=
- "lookups.html#contextual-subs">Element->Font
- Info->Contextual</a> command</td>
- </tr>
- <tr>
- <td>7</td>
- <td>extension positioning</td>
- <td>This is used to allow for a GSUB table which is bigger
- than 64k. Its use should be quite invisible to the font
- designer</td>
- <td>FontForge uses this sub-table when needed.</td>
- </tr>
- <tr>
- <td>8</td>
- <td>reverse chaining contextual single substitution</td>
- <td>This allows glyph substitutions to happen in reverse
- order, and it a variant of the chaining contextual
- subtable.</td>
- <td>These may be created with the <a href=
- "lookups.html#contextual-subs">Element->Font
- Info->Contextual</a> command</td>
- </tr>
- <tr>
- <td>9+</td>
- <td>reserved for future use</td>
- <td></td>
- <td>FontForge does not support these sub-tables yet.<br />
- (nor does anyone)</td>
- </tr>
- </table>
- <p>FontForge also has built into it knowledge on how to provide
- default values for some features that use these tables. See the
- [Populate] button of the various <a href="lookups.html">lookup
- subtable</a> dialogs.</p>
- <p>FontForge can produce some of these tables, but the text
- layout/word processing program used has to look up the tables
- and do the actual work of rearranging the glyphs.</p>
- <p>FontForge will retain the order of features in the GSUB
- table, and the user may adjust it with the <a href=
- "lookups.html#Order">Element->Font Info</a> command.</p>
- <h3>The <b><code><a name="GDEF" id="GDEF">GDEF</a></code></b>
- table</h3>
- <p>FontForge will read ligature carets out of a GDEF table.</p>
- <p>It will generate a GDEF table containing a glyph class
- definition sub-table (if needed) or a ligature caret sub-table
- (if needed).</p>
- <h2><a name="AAT" id="AAT">Apple</a> Advanced Typography</h2>
- <p>As above I do not go deeply into the abilities of these
- tables, for more information see Apple's docs:</p>
- <ul>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6bsln.html">
- The 'bsln' (baseline) table</a></li>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6kern.html">
- The 'kern' table</a></li>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6lcar.html">
- The 'lcar' (ligature caret) table</a></li>
- <li>
- <a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6morx.html">
- The 'morx' (extended glyph metamorphosis) table</a>
- <ul>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6mort.html">
- The 'mort' (older version of 'morx') table</a></li>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6feat.html">
- The 'feat' (feature) table</a></li>
- <li><a href=
- "http://developer.apple.com/fonts/Registry/index.html">Apple's
- Font Feature registry</a></li>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6Tables.html">
- Description of the subtables of the 'mort'/'morx'
- tables</a></li>
- </ul>
- </li>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6opbd.html">
- The 'opbd' (optical bounds) table</a></li>
- <li><a href=
- "http://developer.apple.com/fonts/TTRefMan/RM06/Chap6prop.html">
- The 'prop' (glyph properties) table</a></li>
- </ul>
- <p>FontForge will currently read and produce (if Apple mode is
- set in font generation) the following tables:</p>
- <table border="1" cellpadding="2">
- <caption>
- Apple tables corresponding vaguely to BASE
- </caption>
- <tr>
- <th>tag</th>
- <th>name</th>
- <th>Reading support</th>
- <th>Writing support</th>
- </tr>
- <tr>
- <td><code>'bsln'</code></td>
- <td>baseline table</td>
- <td>FontForge will read baseline data (except for Apple's
- ideographic centered baseline, for which there is no
- OpenType equivalent)</td>
- <td>FontForge will produce this table if the user has
- specified baseline data which apple supports</td>
- </tr>
- </table>
- <table border="1" cellpadding="2">
- <caption>
- Apple tables corresponding vaguely to <a href=
- "#GDEF">GDEF</a>
- </caption>
- <tr>
- <th>tag</th>
- <th>name</th>
- <th>Reading support</th>
- <th>Writing support</th>
- </tr>
- <tr>
- <td><code>'lcar'</code></td>
- <td>ligature caret table</td>
- <td>FontForge will read ligature carets</td>
- <td>FontForge will produce this table if the user has
- specified ligature carets</td>
- </tr>
- <tr>
- <td><code>'prop'</code></td>
- <td>glyph properties table</td>
- <td>FontForge will read this table to figure out which
- glyphs are hebrew and arabic, and which have 'r2la'
- substitutions.</td>
- <td>FontForge will generate this table if the font contains
- some right to left glyphs.</td>
- </tr>
- </table>
- <table border="1" cellpadding="2">
- <caption>
- Apple tables corresponding vaguely to <a href=
- "#GPOS">GPOS</a>
- </caption>
- <tr>
- <th>tag</th>
- <th>name</th>
- <th>Reading support</th>
- <th>Writing support</th>
- </tr>
- <tr>
- <td><code>'kern'</code></td>
- <td>kerning table</td>
- <td>FontForge will read horizontal/vertical kerning pairs
- and classes. FontForge can read contextual kerning
- information too into a state machine.</td>
- <td>FontForge will produce this if the font contains
- kerning data -- kerning pairs, kerning by classes, and
- kerning by state machine.</td>
- </tr>
- <tr>
- <td><code>'opbd'</code></td>
- <td>Optical bounds table</td>
- <td>FontForge will read optical bounds</td>
- <td>FontForge will produce this table if the user has
- specified right and left bounds as simple positions ('lfbd'
- and 'rtbd').</td>
- </tr>
- </table>
- <p>FontForge has support for the <code>'mort'</code> and
- <code>'<a name="morx" id="morx">morx</a>'</code> tables (Glyph
- metamorphosis and extended glyph metamorphosis tables). These
- correspond vaguely to the <a href="#GSUB">GSUB</a> table. Note:
- Any feature type/setting combinations which correspond directly
- to an open type feature will be converted to the opentype tag
- when read in. It will be converted back to a feature/setting
- when an apple font is generated (use <a href=
- "prefs.html#Mac">File->Preferences</a> to extend FontForge's
- mapping from feature type/setting to opentype tags).</p>
- <table border="1" cellpadding="2">
- <caption>
- Sub tables of <code>'mort'</code> or <code>'morx'</code>
- </caption>
- <tr>
- <th></th>
- <th>name</th>
- <th>Reading support</th>
- <th>Writing support</th>
- </tr>
- <tr>
- <td>0</td>
- <td>Indic style rearrangement</td>
- <td>FontForge can read these and stores them as state
- machines (which can be edited with <a href=
- "lookups.html#sm-subs">Font Info</a>)</td>
- <td>Any indic state machines will be output in the
- generated font.</td>
- </tr>
- <tr>
- <td>1</td>
- <td>contextual glyph substitution</td>
- <td>FontForge can read these and stores them as state
- machines (which can be edited with <a href=
- "lookups.html#sm-subs">Font Info</a>)</td>
- <td>
- If the font contains any state machines they will be
- output here. If there are no state machines then the
- following conversions of opentype features will be done:
- <ul>
- <li>FontForge will generate a <a name=
- "cursive-connection" id="cursive-connection">cursive
- connection</a> feature using this subtable type if the
- font contains 'init', 'medi', 'fina' or 'isol' simple
- substitutions.</li>
- <li>In <a href="gposgsub.html#sometimes">some cases</a>
- FontForge is able to convert an OpenType
- Contextual/Chaining substitution table into an Apple
- contextual glyph substitution table.</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td>2</td>
- <td>ligature substitution</td>
- <td>FontForge can read the unconditional information from
- these and stores them as opentype ligatures (which can be
- edited with <a href="lookups.html">Font Info</a> or
- <a href="charinfo.html#lookups">Char Info</a>).</td>
- <td>If there are any ligatures with an apple
- feature/setting (or which have an opentype tag which can be
- converted to an apple feature/setting) then this table will
- be output.</td>
- </tr>
- <tr>
- <td>4</td>
- <td>non-contextual glyph substitution</td>
- <td>FontForge can read these and stores them as opentype
- simple substitutions (which can be edited with <a href=
- "lookups.html">Font Info</a> or <a href=
- "charinfo.html#lookups">Char Info</a>)</td>
- <td>If there are any substitutions with an apple
- feature/setting (or which have an opentype tag which can be
- converted to an apple feature/setting) then this table will
- be output.</td>
- </tr>
- <tr>
- <td>5</td>
- <td>contextual glyph insertion</td>
- <td>FontForge can read these and stores them as state
- machines (which can be edited with <a href=
- "lookups.html#sm-subs">Font Info</a>)</td>
- <td>Any glyph insertion state machines will be output in
- the generated font.</td>
- </tr>
- </table>
- <h3>What features can be <a name="Conversion" id=
- "Conversion">interconverted</a> between OpenType and AAT?</h3>
- <p>Some features have almost the same meaning in OpenType and
- AAT (although they are expressed quite differently), others are
- similar enough that they can sometimes be converted, and others
- have essentially no common ground.</p>
- <table border="1" cellpadding="2">
- <tr>
- <th>OT Table</th>
- <th>AAT Table</th>
- <th>
- <p class="c2">Description</p>
- </th>
- </tr>
- <tr>
- <td valign="top">
- <p class="c3">GDEF</p>
- </td>
- <td valign="top">
- <p class="c3">lcar</p>
- </td>
- <td>The ligature caret information in both 'GDEF' and
- 'lcar' is essentially identical and FontForge has no
- trouble reading both and converting from one to the
- other.</td>
- </tr>
- <tr>
- <td valign="top">
- <p class="c3">BASE</p>
- </td>
- <td valign="top">
- <p class="c3">bsln</p>
- </td>
- <td>There is slightly different baseline data in the two
- formats. 'bsln' does not provide extent information. 'bsln'
- provides a baseline for every glyph, while 'BASE' provides
- a baseline for every script -- one hopes all glyphs in a
- script will have the same baseline, but it isn't
- guaranteed. Finally 'bsln' and 'BASE' provide a slightly
- different set of baseline tags, and FontForge only supports
- the OpenType ones. In particular Apple's ideographic
- centered baseline will be lost.</td>
- </tr>
- <tr>
- <td>
- <p class="c3">GPOS</p>
- </td>
- <td>
- <p class="c3">kern</p>
- </td>
- <td>
- In most cases kerning information can be converted from
- one format to another. Both provide support for vertical
- kerning and right to left kerning. Both provide support
- for kerning by glyph pair and kerning by classes.
- <p>OpenType allows kerning commands to be supplied via a
- contextual chaining feature, Apple allows them to be
- controled by a state machine. FontForge supports both,
- but does not interconvert.</p>
- </td>
- </tr>
- <tr>
- <td>
- <p class="c3">GPOS</p>
- </td>
- <td>
- <p class="c3">opbd</p>
- </td>
- <td>The GPOS features 'lfbd' and 'rtbd' provide the
- information needed to generate an Apple opbd table. If
- FontForge reads a font with an opbd table it will generate
- appropriate 'lfbd' and 'rtbd' features. If FontForge
- generates a font in apple mode that has these features it
- will create an opbd table. Similarly when FontForge reads
- an opbd table it will create 'lfbd' and 'rtbd'
- features.</td>
- </tr>
- <tr>
- <td>
- <p class="c3">GPOS</p>
- </td>
- <td>
- <hr />
- </td>
- <td>I am not aware of any way to convert other GPOS
- features to AAT.</td>
- </tr>
- <tr>
- <td>
- <p class="c3">GSUB</p>
- </td>
- <td>
- <p class="c3">morx</p>
- </td>
- <td rowspan="2">The 'mort' and 'morx' tables have the same
- capabilities ('mort' tables are an old format and Apple
- currently encourages that 'morx' tables be used instead).
- FontForge can read either one, but only generates 'morx'
- tables. Interconversion depends on specific feature types
- and the sub-table formats, see below</td>
- </tr>
- <tr>
- <td>
- <p class="c3">GSUB</p>
- </td>
- <td>
- <p class="c3">mort</p>
- </td>
- </tr>
- </table>
- <h4>An analysis of GSUB and morx sub-tables and feature
- tags</h4>
- <p>OpenType uses a four character feature tag (like 'liga')
- while Apple uses two numbers to represent a feature setting
- (<1,2>). For FontForge to be able to inter-convert an
- OpenType feature into an Apple feature there must first be a
- correspondence between the two naming conventions. Sometimes
- there is an easy direct conversion (above 'liga' and
- <1,2> both represent "Common Ligatures") but far more
- often there is none. See <a href=
- "gposgsub.html#OT-Mac-features">below</a> for a list of the
- tags and feature settings that FontForge considers similar
- enough to interconvert.</p>
- <p>GSUB tables have 7 sub-table formats, while morx tables have
- 5.</p>
- <table border="1" cellpadding="2">
- <tr>
- <th>GSUB<br />
- sub-<br />
- table</th>
- <th>morx<br />
- sub-<br />
- table</th>
- <th>
- <p class="c2">Description</p>
- </th>
- </tr>
- <tr>
- <td valign="top">
- <p class="c3">Single</p>
- </td>
- <td valign="top">
- <p class="c3">Non-<br />
- Contextual<br />
- Glyph</p>
- </td>
- <td>These two sub-tables have almost exactly the same
- capabilities. Each allows one glyph to be substituted for
- another. The morx sub-table also allows a glyph to be
- deleted, while the GSUB sub-table does not.</td>
- </tr>
- <tr>
- <td valign="top">
- <p class="c3">Multiple</p>
- </td>
- <td></td>
- <td>
- This GSUB subtable allows a single glyph to be replaced
- by multiple glyphs. It has some similarities to Apple's
- Glyph Insertion sub-table except:
- <ul>
- <li>the 'morx' sub-table always leaves the current
- glyph in the glyph stream, while this sub-table need
- not</li>
- <li>the 'morx' sub-table is contextual while this
- sub-table is never. (But if this sub-table is wrapped
- inside a Context or Chaining Context subtable the
- result can be contextual).</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td></td>
- <td valign="top">
- <p class="c3">Glyph<br />
- Insertion</p>
- </td>
- <td>This morx subtable allows a string of glyphs to be
- inserted before or after the current glyph (the current
- glyph always remains). This sub-table is contextual (ie.
- the insertion can be restricted to certain contexts). It
- bears some similarities to the GSUB Multiple subtable
- above.</td>
- </tr>
- <tr>
- <td valign="top">Alternate</td>
- <td></td>
- <td>This GSUB subtable allows a single glyph to be replaced
- by any one of several alternatives (presumably with help
- from a word processor's UI). An example of this would be a
- character which had several swash variants. There is
- nothing like this in the 'morx' table.</td>
- </tr>
- <tr>
- <td valign="top">
- <p class="c3">Ligature</p>
- </td>
- <td valign="top">
- <p class="c3">Ligature</p>
- </td>
- <td>
- Both formats have ligature sub-tables. The 'GSUB' version
- is unconditional (the ligature is always applied --
- though a ligature substitution could be embedded in an
- OpenType contextual substitution to make it condtional).
- The 'morx' version can be contextual (though in fonts I
- have examined it is usually uncontextual). FontForge only
- supports unconditional ligatures.
- <p>FontForge can read all the unconditional ligatures
- from a 'morx' sub-table. FontForge loses all contextual
- ligatures.</p>
- <p>In OpenType, contextual ligatures can be built by
- wrapping a ligature sub-table inside a Context or
- Chaining Context subtable.</p>
- </td>
- </tr>
- <tr>
- <td></td>
- <td valign="top">
- <p class="c3">Contextual<br />
- Glyph</p>
- </td>
- <td>This morx subtable allows single glyph substitutions to
- be applied within certain contexts. At first glance it
- seems that this could be converted into an opentype Context
- subtable, <a href="gposgsub.html#sometimes">but this is
- rarely the case</a>.</td>
- </tr>
- <tr>
- <td>
- <p class="c3">Context</p>
- </td>
- <td></td>
- <td rowspan="2" valign="top">These GSUB subtables allow any
- collection of other substitutions to be applied
- contextually. At first glance one might think that these
- (with appropriate nested substitutions) might be converted
- to 'morx' contextual glyph substitutions, contextual
- ligatures, or even glyph insertion. <a href=
- "gposgsub.html#sometimes">Unfortunately this is rarely the
- case</a>.</td>
- </tr>
- <tr>
- <td>
- <p class="c3">Chaining<br />
- Context</p>
- </td>
- <td></td>
- </tr>
- <tr valign="top">
- <td>
- <p class="c3">Reverse<br />
- Chaining<br />
- Context</p>
- </td>
- <td></td>
- <td>This GSUB subtable is applied backwards to the stream
- of glyphs, it allows a single glyph substitution per
- contextual match. There is nothing like it in 'morx'.</td>
- </tr>
- <tr valign="top">
- <td></td>
- <td>
- <p class="c3">Indic<br />
- Rearrange-<br />
- ment</p>
- </td>
- <td>This 'morx' subtable allows for several glyphs to
- interchange their positions in the glyph stream. There is
- nothing like it in GSUB (or GPOS for that matter).</td>
- </tr>
- </table>
- <h4>Why do contextual glyph substitutions only <a name=
- "sometimes" id="sometimes">sometimes</a> get generated in
- AAT?</h4>
- <p>Sadly OpenType and AAT provide disjoint capabilities when it
- comes to contextual matching. AAT is more capable in some
- areas, OpenType more capable in others. FontForge is able to
- convert an OpenType contextual substitution into an AAT one if
- FontForge can detect that the OpenType substitution does not
- use capabilities beyond those of AAT. Currently this means:</p>
- <ul>
- <li>There is an apple feature which matches the otf tag</li>
- <li>And one of the following is true:
- <ol>
- <li>Either
- <ul>
- <li>The sub-table is in coverage format</li>
- <li>The sub-table contains either exactly one nested
- single glyph replacement substitution, or<br />
- it contains exactly two single glyph replacements and
- one of them refers to the last glyph matched (and the
- other does not)</li>
- </ul>
- </li>
- <li>or
- <ul>
- <li>The sub-table is in either glyph or class
- format</li>
- <li>If in class format then either the backtrack and
- lookahead classes must be the same as the main class,
- or they must not be used.</li>
- <li>If a rule has a substitution at a given glyph
- position, then all rules which match the current rule
- up to that glyph position must also have a
- substitution at that position.</li>
- <li>A rule with exactly one substitution is
- acceptable<br />
- A rule with one substitution in the middle and one
- substitution on the last glyph is acceptable.<br />
- A rule may contain more substitutions only if there
- is another rule which matches it exactly up to the
- internal substitution.<br />
- So the following rule set is valid:
- <table border="1" cellpadding="2">
- <tr>
- <th>Rule</th>
- <td>a</td>
- <td>b</td>
- <td>c</td>
- <td>d</td>
- <td>e</td>
- <td>f</td>
- </tr>
- <tr>
- <th>Rule</th>
- <td>a</td>
- <td>b</td>
- <td>c</td>
- <td>d</td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <th>Rule</th>
- <td>a</td>
- <td>b</td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <th>Substitutions</th>
- <td>A</td>
- <td>B</td>
- <td>C</td>
- <td>D</td>
- <td>E</td>
- <td>F</td>
- </tr>
- </table>
- <p>So the third rule will match an "ab" and convert
- them to "AB" (and this is valid because we have one
- internal and one final substitution and that's ok),
- then if that "ab" is followed by "cd" then rule 2
- kicks in and will replace the "cd" with "CD" (again
- this has one internal and one final substitution,
- which is ok), and if that is followed by "ef" then
- they will be converted to "EF".</p>
- <p>The following is not valid:</p>
- <table border="1" cellpadding="2">
- <tr>
- <th>Substitution</th>
- <td></td>
- <td>B</td>
- <td></td>
- </tr>
- <tr>
- <th>Rule</th>
- <td>a</td>
- <td>b</td>
- <td>c</td>
- </tr>
- <tr>
- <td colspan="4">
- <hr />
- </td>
- </tr>
- <tr>
- <th>Rule</th>
- <td>a</td>
- <td>b</td>
- <td></td>
- </tr>
- <tr>
- <th>Substitution</th>
- <td>A</td>
- <td></td>
- <td></td>
- </tr>
- </table>
- <p>The two rules have substitutions at different
- places and that can't be expressed in an Apple
- state machine given that they have the same
- glyphs.</p>
- </li>
- </ul>
- </li>
- </ol>
- </li>
- </ul>
- <p>FontForge does not even try to convert an AAT contextual
- glyph substitution sub-table, too few of these can be expressed
- in OpenType to make it worth while.</p>
- <p>NOTE: It would be possible to convert more lookups to state
- machines if FontForge were willing to:</p>
- <ol>
- <li>Use several state machines to represent complicated
- lookups</li>
- <li>Add additional glyphs to the font to be used as temporary
- state flags.</li>
- </ol>
- <p>FontForge will do neither of these.</p>
- <h4 class="c4">BUG</h4>
- <p>There is a subtle bug involved in converting a chaining
- contextual substitution into an Apple contextual glyph
- substitution. AAT does not have the concept of a backtrack
- list, this means that substitutions may occur in a different
- order.</p>
- <h4>Why can't all contextual/chaining tables be <a name=
- "not-converted" id="not-converted">converted</a>?</h4>
- <p>Well, obviously there are some thing that just aren't
- present. The concept of contextual positioning is missing from
- AAT, while Indic rearrangement is missing from OpenType. So
- let's concentrate on contextual substitutions, which both
- appear to support. The argument that follows is based on the
- capabilities of contextual matching, it applies equally to
- contextual ligatures, glyph insertion, glyph substitution and
- kerning, the examples given are only of glyph substitution
- because it is easier to represent (and because FontForge is
- only willing to convert contextual glyph substitutions) But
- even here, there is a very basic mismatch in concepts between
- the way OpenType and Apple specify contextual substitutions.
- Consider the following contextual substitution in a glyph list
- format:</p>
- <table border="1" cellpadding="2">
- <tr>
- <th>Initial Sequence</th>
- <td>a</td>
- <td>b</td>
- <td>c</td>
- <td>d</td>
- </tr>
- <tr>
- <th>
- <p class="c2">Replace With</p>
- </th>
- <td> </td>
- <td>B</td>
- <td>C</td>
- <td> </td>
- </tr>
- </table>
- <p>Now in OpenType this means if you find the sequence "abcd"
- then replace the "b" with "B" and the "c" with "C". But this
- can't be expressed in an Apple state machine. In OpenType the
- match is done first, and then the substitutions occur. In a
- state machine the substitutions have to be done (almost)
- concurrently with the match and so must happen whether the
- final "d" is present or not. (Note I'm using a glyph sequence
- because it is easier to display in an example. The same problem
- applies if the substitution is expressed by classes or by
- coverage tables)</p>
- <p>Consider the following table with two glyph strings</p>
- <table border="1" cellpadding="2">
- <tr>
- <th>Initial Sequence</th>
- <td>a</td>
- <td>
- <p class="c3">b</p>
- </td>
- <td>
- <p class="c3">c</p>
- </td>
- <td>d</td>
- </tr>
- <tr>
- <th>
- <p class="c2">Replace With</p>
- </th>
- <td> </td>
- <td>
- <p class="c3">B</p>
- </td>
- <td></td>
- <td> </td>
- </tr>
- <tr>
- <th>Initial Sequence</th>
- <td>a</td>
- <td>
- <p class="c3">b</p>
- </td>
- <td>
- <p class="c3">c</p>
- </td>
- <td>e </td>
- </tr>
- <tr>
- <th>
- <p class="c2">Replace With</p>
- </th>
- <td> </td>
- <td></td>
- <td>
- <p class="c3"> C</p>
- </td>
- <td> </td>
- </tr>
- </table>
- <p>So replace the "b" if the final "d" is present, otherwise
- replace the "c". Again this cannot be expressed in Apple's
- state machines.</p>
- <p>Finally consider</p>
- <table border="1" cellpadding="2">
- <tr>
- <th>Initial Sequence</th>
- <td>
- <p class="c3">a</p>
- </td>
- <td>
- <p class="c3">b</p>
- </td>
- <td>
- <p class="c3">c</p>
- </td>
- <td>d</td>
- </tr>
- <tr>
- <th>
- <p class="c2">Replace With</p>
- </th>
- <td> </td>
- <td>
- <p class="c3"></p>
- </td>
- <td>C</td>
- <td> </td>
- </tr>
- <tr>
- <th>Initial Sequence</th>
- <td>
- <p class="c3">b</p>
- </td>
- <td>
- <p class="c3">c</p>
- </td>
- <td>
- <p class="c3">e</p>
- </td>
- <td></td>
- </tr>
- <tr>
- <th>
- <p class="c2">Replace With</p>
- </th>
- <td>
- <p class="c3">B </p>
- </td>
- <td></td>
- <td>
- <p class="c3"> </p>
- </td>
- <td> </td>
- </tr>
- </table>
- <p>If this substitution is given the sequence "abce" it cannot
- work in AAT. When it reads the "a" it will start down the
- "abcd" branch, the match will not fail until it looks for the
- "d" and finds "e" instead. At that point it is too late to
- switch to the "bce" substitution (which does match) because the
- "b" glyph will not have been marked as a substitution
- location.</p>
- <hr />
- On the other hand, Apple's state machines can express things
- that OpenType tables cannot (again I'm restricting myself to
- contextual glyph substitutions). Consider the case of a swash
- glyph at the beginning (or end) of a word. Let us say that a
- word begins when a letter appears at the start of input or
- following a whitespace character. But OpenType has no way of
- expressing "start of input" (or end of input) in a
- contextual/chaining context, whereas Apple's state machines do.
- <p>Since Apple's glyph substitutions can delete glyphs a
- contextual glyph substitution table can create two character
- ligatures (one glyph is converted to the ligature and the other
- is deleted), while OpenType tables must use a ligature
- substitution to do this.</p>
- <p>Finally an AAT state machine can match a general regular
- expression, while OpenType tables can only match fixed length
- strings. Suppose you were typesetting mathematics and wanted a
- substitution which would convert an arbitrary digit string
- following a variable into a subscript (so x23 should become
- x<small><sub>23</sub></small>). It is easy to write a state
- machine which will keep substituting as long as it gets more
- digits, but you'd need an infinite number of OpenType rules to
- have the same expressive power.</p>
- <p>These examples probably seem fairly contrived, and (except
- for the swash one) they are. But they illustrate the point that
- the two formats have very different expressive capabilities and
- it is NOT possible to write a converter which will take any
- input in one format and produce an equivalent output in the
- other.</p>
- <h3>Apple and OpenType features</h3>
- <table border="1" cellpadding="2">
- <caption>
- Correspondences between Apple and OpenType <a name=
- "OT-Mac-features" id="OT-Mac-features">features</a><br />
- (that I support)
- </caption>
- <tr>
- <th>Apple Feature Setting</th>
- <th>OpenType Feature Name</th>
- <th>OpenType Tag</th>
- </tr>
- <tr>
- <td>Required Ligatures</td>
- <td>Required Ligatures</td>
- <td>rlig</td>
- </tr>
- <tr>
- <td>Common Ligatures</td>
- <td>Standard Ligatures</td>
- <td>liga</td>
- </tr>
- <tr>
- <td>Rare Ligatures</td>
- <td>Discretionary</td>
- <td>dlig</td>
- </tr>
- <tr>
- <td>Fractions</td>
- <td>Fractions</td>
- <td>frac</td>
- </tr>
- <tr>
- <td colspan="3">
- <hr />
- </td>
- </tr>
- <tr>
- <td>Contextual Alternatives</td>
- <td>Cursive connection</td>
- <td>calt</td>
- </tr>
- <tr>
- <td colspan="3">
- <hr />
- </td>
- </tr>
- <tr>
- <td>Vertical Forms</td>
- <td>Vertical Rotation 2</td>
- <td>vrt2</td>
- </tr>
- <tr>
- <td>Monospace numbers</td>
- <td>Tabular numbers</td>
- <td>tnum</td>
- </tr>
- <tr>
- <td>Superscript</td>
- <td>Superscript</td>
- <td>sups</td>
- </tr>
- <tr>
- <td>Subscript</td>
- <td>Subscript</td>
- <td>subs</td>
- </tr>
- <tr>
- <td>Proportional Text</td>
- <td>Proportional Widths</td>
- <td>pwid</td>
- </tr>
- <tr>
- <td>Half-width Text</td>
- <td>Half Width</td>
- <td>hwid</td>
- </tr>
- <tr>
- <td>Full-width Text</td>
- <td>Full Width</td>
- <td>fwid</td>
- </tr>
- <tr>
- <td>Traditional Characters</td>
- <td>Traditional</td>
- <td>trad</td>
- </tr>
- <tr>
- <td>Simplified Characters</td>
- <td>Simplified</td>
- <td>smpl</td>
- </tr>
- <tr>
- <td>JIS 1978 Characters</td>
- <td>JIS 1978 Characters</td>
- <td>jp78</td>
- </tr>
- <tr>
- <td>JIS 1983 Characters</td>
- <td>JIS 1983 Characters</td>
- <td>jp83</td>
- </tr>
- <tr>
- <td>JIS 1990 Characters</td>
- <td>JIS 1990 Characters</td>
- <td>jp90</td>
- </tr>
- </table>
- <p>FontForge will retain the order of features in the morx
- table, and the user may adjust it with the <a href=
- "fontinfo.html#Lookups">Element->Font Info</a> command.
- (this is the same list as that used for GSUB table. GSUB
- features that don't correspond to mac features will be
- ignored).</p>
- <h2>What is <a name="Unsupported" id=
- "Unsupported">Unsupported</a>?</h2>
- <p>FontForge does not (yet) support all the advanced
- typographic features available in either opentype or apple
- advanced typography.</p>
- <h3>OpenType</h3>
- <ul>
- <li>FontForge does not provide an attachment list subtable
- nor a MarkAttachClassDef subtable of the GDEF table.</li>
- <li>FontForge does not support the VORG and JUST tables</li>
- </ul>
- <p><a href="TrueOpenTables.html">See here for a complete list
- of supported tables</a>.</p>
- <h3>Apple Advanced Typography</h3>
- <ul>
- <li>FontForge will never generate a 'mort' table. It can read
- 'mort' tables, but it will only produce 'morx' tables.</li>
- <li>FontForge is unable to parse contextual ligatures. It can
- find ligatures which start from state 0, but it will not find
- ligatures which start from other states (that is, which are
- contextual)</li>
- <li>FontForge does not support the following Apple specific
- tables
- <ul>
- <li>acnt (accent attachment)</li>
- <li>bsln (baseline)</li…
Large files files are truncated, but you can click here to view the full file