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

java.lang.Object
  extended by org.extex.font.format.xtf.tables.gps.LangSysRecord
All Implemented Interfaces:
XMLWriterConvertible

public class LangSysRecord
extends java.lang.Object
implements XMLWriterConvertible

Class for a langsys table.

Version:
$Revision: 7274 $
Author:
Michael Niedermair

Constructor Summary
LangSysRecord(RandomAccessR rar)
          Creates a new object.
 
Method Summary
 int[] getFeatureIndex()
          Getter for featureIndex.
 int getLookupOrderOffset()
          Getter for lookupOrderOffset.
 int getOffset()
          Getter for offset.
 int getReqFeatureIndex()
          Getter for reqFeatureIndex.
 LanguageSystemTag getTag()
          Getter for tag.
 void read(RandomAccessR rar, int baseoffset)
          Read the language system table.
 void writeXML(XMLStreamWriter writer)
          Write the data to a XMLStreamWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LangSysRecord

public LangSysRecord(RandomAccessR rar)
              throws java.io.IOException
Creates a new object.

Parameters:
rar - input
Throws:
java.io.IOException - if a io-error occurred.
Method Detail

getFeatureIndex

public int[] getFeatureIndex()
Getter for featureIndex.

Returns:
the featureIndex

getLookupOrderOffset

public int getLookupOrderOffset()
Getter for lookupOrderOffset.

Returns:
the lookupOrderOffset

getOffset

public int getOffset()
Getter for offset.

Returns:
the offset

getReqFeatureIndex

public int getReqFeatureIndex()
Getter for reqFeatureIndex.

Returns:
the reqFeatureIndex

getTag

public LanguageSystemTag getTag()
Getter for tag.

Returns:
the tag

read

public void read(RandomAccessR rar,
                 int baseoffset)
          throws java.io.IOException
Read the language system table.

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.)
Optionally, a LangSys table may define a Required Feature Index (ReqFeatureIndex) to specify one feature as required within the context of a particular language system. For example, in the Cyrillic script, the Serbian language system always renders certain glyphs differently than the Russian language system.
Only one feature index value can be tagged as the ReqFeatureIndex. This is not a functional limitation, however, because the feature and lookup definitions in OpenType Layout are structured so that one feature table can reference many glyph substitution and positioning lookups. When no required features are defined, then the ReqFeatureIndex is set to 0xFFFF.
All other features are optional. For each optional feature, a zero-based index value references a record (FeatureRecord) in the FeatureRecord array, which is stored in a Feature List table (FeatureList). The feature indices themselves (excluding the ReqFeatureIndex) are stored in arbitrary order in the FeatureIndex array. The FeatureCount specifies the total number of features listed in the FeatureIndex array.
Features are specified in full in the FeatureList table, FeatureRecord, and Feature table, which are described later in this chapter. Example 2 at the end of this chapter shows a Script table, LangSysRecord, and LangSys table used for contextual positioning in the Arabic script.

LangSys table

Type Name Description
Offset LookupOrder = NULL (reserved for an offset to a reordering table)
uint16 ReqFeatureIndex Index of a feature required for this language system- if no required features = 0xFFFF
uint16 FeatureCount Number of FeatureIndex values for this language system-excludes the required feature
uint16 FeatureIndex[FeatureCount] Array of indices into the FeatureList-in arbitrary order

Parameters:
rar - The input.
baseoffset - The base offset.
Throws:
java.io.IOException - if a io-error occurred.

writeXML

public void writeXML(XMLStreamWriter writer)
              throws java.io.IOException
Write the data to a XMLStreamWriter.

Specified by:
writeXML in interface XMLWriterConvertible
Parameters:
writer - the XML-Writer
Throws:
java.io.IOException - if an IO-error occurs.
See Also:
XMLWriterConvertible.writeXML( org.extex.util.xml.XMLStreamWriter)