org.extex.font.format.xtf.tables.gps
Class OtfTableGPOS

java.lang.Object
  extended by org.extex.font.format.xtf.tables.AbstractXtfTable
      extended by org.extex.font.format.xtf.tables.gps.AbstractXtfSFLTable
          extended by org.extex.font.format.xtf.tables.gps.OtfTableGPOS
All Implemented Interfaces:
LookupTableFactory, XtfGlyphName, XtfTable, XMLWriterConvertible

public class OtfTableGPOS
extends AbstractXtfSFLTable
implements XtfTable, LookupTableFactory, XMLWriterConvertible

Table gpos.

http://partners.adobe.com/public/developer/opentype/index_table_formats2.html

The Glyph Positioning table (GPOS) provides precise control over glyph placement for sophisticated text layout and rendering in each script and language system that a font supports.

Table Organization

The GPOS table begins with a header that defines offsets to a ScriptList, a FeatureList, and a LookupList:

The GPOS table is organized so text processing clients can easily locate the features and lookups that apply to a particular script or language system. To access GPOS information, clients should use the following procedure:

  1. Locate the current script in the GPOS ScriptList table.
  2. If the language system is known, search the script for the correct LangSys table; otherwise, use the script's default language system (DefaultLangSys table).
  3. The LangSys table provides index numbers into the GPOS FeatureList table to access a required feature and a number of additional features.
  4. Inspect the FeatureTag of each feature, and select the features to apply to an input glyph string.
  5. Each feature provides an array of index numbers into the GPOS LookupList table. Lookup data is defined in one or more subtables that contain information about specific glyphs and the kinds of operations to be performed on them.
  6. Assemble all lookups from the set of chosen features, and apply the lookups in the order given in the LookupList table.

A lookup uses subtables to define the specific conditions, type, and results of a positioning action used to implement a feature. All subtables in a lookup must be of the same LookupType, as listed in the LookupType Enumeration table:

LookupType Enumeration table for glyph positioning

Value Type Description
1 Single adjustment Adjust position of a single glyph
2 Pair adjustment Adjust position of a pair of glyphs
3 Cursive attachment Attach cursive glyphs
4 MarkToBase attachment Attach a combining mark to a base glyph
5 MarkToLigature attachment Attach a combining mark to a ligature
6 MarkToMark attachment Attach a combining mark to another mark
7 Context positioning Position one or more glyphs in context
8 Chained Context positioning Position one or more glyphs in chained context
9 Extension positioning Extension mechanism for other positionings
10+ Reserved For future use

Each LookupType is defined by one or more subtables, whose format depends on the type of positioning operation and the resulting storage efficiency. When glyph information is best presented in more than one format, a single lookup may define more than one subtable, as long as all the subtables are of the same LookupType. For example, within a given lookup, a glyph index array format may best represent one set of target glyphs, whereas a glyph index range format may be better for another set.

A series of positioning operations on the same glyph or string requires multiple lookups, one for each separate action. The values in the ValueRecords are accumulated in these cases. Each lookup is given a different array number in the LookupList table and is applied in the LookupList order.

During text processing, a client applies a lookup to each glyph in the string before moving to the next lookup. A lookup is finished for a glyph after the client locates the target glyph or glyph context and performs a positioning, if specified. To move to the "next" glyph, the client will typically skip all the glyphs that participated in the lookup operation: glyphs that were positioned as well as any other glyphs that formed a context for the operation.

There is just one exception: the "next" glyph in a sequence may be one of those that formed a context for the operation just performed. For example, in the case of pair positioning operations (i.e., kerning), if the position value record for the second glyph is null, that glyph is treated as the "next" glyph in the sequence.

This rest of this chapter describes the GPOS header and the subtables defined for each LookupType. Several GPOS subtables share other tables: ValueRecords, Anchor tables, and MarkArrays. For easy reference, the shared tables are described at the end of this chapter.

GPOS Header

The GPOS table begins with a header that contains a version number (Version) initially set to 1.0 (0x00010000) and offsets to three tables: ScriptList, FeatureList, and LookupList.

Value Type Description
Fixed Version Version of the GPOS table-initially = 0x00010000
Offset ScriptList Offset to ScriptList table-from beginning of GPOS table
Offset FeatureList Offset to FeatureList table-from beginning of GPOS table
Offset LookupList Offset to LookupList table-from beginning of GPOS table

Version:
$Revision: 7274 $
Author:
Michael Niedermair

Field Summary
 
Fields inherited from class org.extex.font.format.xtf.tables.gps.AbstractXtfSFLTable
featureList, lookupList, scriptList
 
Constructor Summary
OtfTableGPOS(XtfTableMap tablemap, XtfTableDirectory.Entry de, RandomAccessR rar)
          Create a new object.
 
Method Summary
 java.lang.String getShortcut()
          Returns the table shortcut.
 int getType()
          Get the table type, as a table directory value.
 java.lang.String lookupType(int type)
          Returns the name of the lookup type (The start index is 1!).
 XtfLookupTable read(RandomAccessR rar, int posOffset, int type, int offset, XtfGlyphName xtfGlyph)
          Read the LookupTable or null, if not found.
 
Methods inherited from class org.extex.font.format.xtf.tables.gps.AbstractXtfSFLTable
findLangSys, findLookup, findScript, getFeatureList, getFeatureTag, getLookupList, getScriptList, writeXML
 
Methods inherited from class org.extex.font.format.xtf.tables.AbstractXtfTable
getGlyphName, getInitOrder, getTableMap, init, writeStartElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.extex.font.format.xtf.tables.XtfTable
getInitOrder, getTableMap, init
 
Methods inherited from interface org.extex.util.xml.XMLWriterConvertible
writeXML
 

Constructor Detail

OtfTableGPOS

public OtfTableGPOS(XtfTableMap tablemap,
                    XtfTableDirectory.Entry de,
                    RandomAccessR rar)
             throws java.io.IOException
Create a new object.

Parameters:
tablemap - the table map
de - directory entry
rar - input
Throws:
java.io.IOException - if an IO-error occurs
Method Detail

getShortcut

public java.lang.String getShortcut()
Returns the table shortcut.

Specified by:
getShortcut in interface XtfTable
Returns:
Returns the table shortcut.
See Also:
XtfTable.getShortcut()

getType

public int getType()
Get the table type, as a table directory value.

Specified by:
getType in interface XtfTable
Returns:
Returns the table type

lookupType

public java.lang.String lookupType(int type)
Returns the name of the lookup type (The start index is 1!).

Specified by:
lookupType in interface LookupTableFactory
Parameters:
type - The type.
Returns:
Returns the name of the lookup type.
See Also:
LookupTableFactory.lookupType(int)

read

public XtfLookupTable read(RandomAccessR rar,
                           int posOffset,
                           int type,
                           int offset,
                           XtfGlyphName xtfGlyph)
                    throws java.io.IOException
Read the LookupTable or null, if not found.

Type:

  • 1 - Single - Replace one glyph with one glyph
  • 2 - Multiple - Replace one glyph with more than one glyph
  • 3 - Alternate - Replace one glyph with one of many glyphs
  • 4 - Ligature - Replace multiple glyphs with one glyph
  • 5 - Context - Replace one or more glyphs in context
  • 6 - Chaining - Context Replace one or more glyphs in chained context
  • Specified by:
    read in interface LookupTableFactory
    Parameters:
    rar - The input.
    posOffset - The offset of the pos table (GPOS, GSUB).
    type - The table type.
    offset - The offset.
    xtfGlyph - The glyph name.
    Returns:
    Returns the table.
    Throws:
    java.io.IOException - if a io-error occurred.
    See Also:
    LookupTableFactory.read(org.extex.util.file.random.RandomAccessR, int, int, int, org.extex.font.format.xtf.tables.XtfGlyphName)