org.extex.font.format.xtf.tables.gps
Class XtfGPOSSingleTable.SingleTableFormat2

java.lang.Object
  extended by org.extex.font.format.xtf.tables.gps.XtfLookupTable
      extended by org.extex.font.format.xtf.tables.gps.XtfGPOSSingleTable
          extended by org.extex.font.format.xtf.tables.gps.XtfGPOSSingleTable.SingleTableFormat2
All Implemented Interfaces:
XMLWriterConvertible
Enclosing class:
XtfGPOSSingleTable

public static class XtfGPOSSingleTable.SingleTableFormat2
extends XtfGPOSSingleTable
implements XMLWriterConvertible

Single Adjustment Positioning: Format 2

A SinglePosFormat2 subtable provides an array of ValueRecords that contains one positioning value for each glyph in the Coverage table. This format is more flexible than Format 1, but it requires more space in the font file.

For example, assume that the Cyrillic script will be used in left-justified text. For all glyphs, Format 2 could define position adjustments for left side bearings to align the left edges of the paragraphs. To achieve this, the Coverage table would list every glyph in the script, and the SinglePosFormat2 subtable would define a ValueRecord for each covered glyph. Correspondingly, each ValueRecord would specify an XPlacement adjustment value for the left side bearing.

Note: All ValueRecords defined in a SinglePos subtable must have the same ValueFormat. In this example, if XPlacement is the only value that a ValueRecord needs to optically align the glyphs, then XPlacement will be the only value specified in the ValueFormat of the subtable.

As in Format 1, the Format 2 subtable consists of a format identifier (PosFormat), an offset to a Coverage table that defines the glyphs to be adjusted by the positioning values (Coverage), and the format identifier (ValueFormat) that describes the amount and kinds of data in the ValueRecords. In addition, the Format 2 subtable includes:

  • A count of the ValueRecords (ValueCount). One ValueRecord is defined for each glyph in the Coverage table.
  • An array of ValueRecords that specify positioning values (Value). Because the array follows the Coverage Index order, the first ValueRecord applies to the first glyph listed in the Coverage table, and so on.
  • SinglePosFormat2 subtable: Array of positioning values

    Value Type Description
    uint16 PosFormat Format identifier-format = 2
    Offset Coverage Offset to Coverage table-from beginning of SinglePos subtable
    uint16 ValueFormat Defines the types of data in the ValueRecord
    uint16 ValueCount Number of ValueRecords
    ValueRecord Value [ValueCount] Array of ValueRecords-positioning values applied to glyphs


    Nested Class Summary
     
    Nested classes/interfaces inherited from class org.extex.font.format.xtf.tables.gps.XtfGPOSSingleTable
    XtfGPOSSingleTable.SingleTableFormat1, XtfGPOSSingleTable.SingleTableFormat2
     
    Field Summary
     
    Fields inherited from class org.extex.font.format.xtf.tables.gps.XtfGPOSSingleTable
    coverage
     
    Fields inherited from class org.extex.font.format.xtf.tables.gps.XtfLookupTable
    count
     
    Method Summary
     int getValueFormat()
              Getter for valueFormat.
     ValueRecord getValueRecord(int glyph)
              Returns the ValueRecord for the glyph.
     ValueRecord[] getValueRecordArray()
              Getter for valueRecordArray.
     void writeXML(XMLStreamWriter writer)
              Write the data to a XMLStreamWriter.
     
    Methods inherited from class org.extex.font.format.xtf.tables.gps.XtfGPOSSingleTable
    getCoverage, newInstance
     
    Methods inherited from class org.extex.font.format.xtf.tables.gps.XtfLookupTable
    getCount, getFormat, getXtfGlyph
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    getValueFormat

    public int getValueFormat()
    Getter for valueFormat.

    Returns:
    the valueFormat

    getValueRecord

    public ValueRecord getValueRecord(int glyph)
    Returns the ValueRecord for the glyph.

    Specified by:
    getValueRecord in class XtfGPOSSingleTable
    Parameters:
    glyph - The glyph.
    Returns:
    Returns the ValueRecord for the glyph or null, if not found.
    See Also:
    XtfGPOSSingleTable.getValueRecord(int)

    getValueRecordArray

    public ValueRecord[] getValueRecordArray()
    Getter for valueRecordArray.

    Returns:
    the valueRecordArray

    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)