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

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

public class ValueRecord
extends java.lang.Object
implements XMLWriterConvertible

Class for a ValueRecord.

GPOS subtables use ValueRecords to describe all the variables and values used to adjust the position of a glyph or set of glyphs. A ValueRecord may define any combination of X and Y values (in design units) to add to (positive values) or subtract from (negative values) the placement and advance values provided in the font. A ValueRecord also may contain an offset to a Device table for each of the specified values. If a ValueRecord specifies more than one value, the values should be listed in the order shown in the ValueRecord definition.

The text-processing client must be aware of the flexible and multi-dimensional nature of ValueRecords in the GPOS table. Because the GPOS table uses ValueRecords for many purposes, the sizes and contents of ValueRecords may vary from subtable to subtable.

ValueRecord (all fields are optional)

Value Type Description
int16 XPlacement Horizontal adjustment for placement-in design units
int16 YPlacement Vertical adjustment for placement-in design units
int16 XAdvance Horizontal adjustment for advance-in design units (only used for horizontal writing)
int16 YAdvance Vertical adjustment for advance-in design units (only used for vertical writing)
Offset XPlaDevice Offset to Device table for horizontal placement-measured from beginning of PosTable (may be NULL)
Offset YPlaDevice Offset to Device table for vertical placement-measured from beginning of PosTable (may be NULL)
Offset XAdvDevice Offset to Device table for horizontal advance-measured from beginning of PosTable (may be NULL)
Offset YAdvDevice Offset to Device table for vertical advance-measured from beginning of PosTable (may be NULL)

Version:
$Revision: 7274 $
Author:
Michael Niedermair

Field Summary
static int[] MASK
          The MASK for the ValueFormat.
static java.lang.String[] NAME
          The Name for the ValueFormat.
static int RESERVED
          For future use.
static int X_ADV_DEVICE
          Includes horizontal Device table for advance.
static int X_ADVANCE
          Includes horizontal adjustment for advance.
static int X_PLA_DEVICE
          Includes horizontal Device table for placement.
static int X_PLACEMENT
          Includes horizontal adjustment for placement.
static int Y_ADV_DEVICE
          Includes vertical Device table for advance.
static int Y_ADVANCE
          Includes vertical adjustment for advance.
static int Y_PLA_DEVICE
          Includes vertical Device table for placement.
static int Y_PLACEMENT
          Includes vertical adjustment for placement.
 
Constructor Summary
ValueRecord(RandomAccessR rar, int posOffset, XtfGlyphName xtfGlyph, int valueFormat)
          Creates a new object.
 
Method Summary
static int getMask(int value)
          Returns the mask of the ValueFormat or -1, if not found.
static int getMaskLength()
          Returns the length of the mask array.
static java.lang.String getName(int value)
          Returns the name of the ValueFormat.
 int getValueFormat()
          Getter for valueFormat.
 int getXAdvance()
          Getter for xAdvance.
 DeviceTable getXAdvDevice()
          Getter for xAdvDevice.
 int getXAdvDeviceOffset()
          Getter for xAdvDeviceOffset.
 int getXPlacement()
          Getter for xPlacement.
 DeviceTable getXPlaDevice()
          Getter for xPlaDevice.
 int getXPlaDeviceOffset()
          Getter for xPlaDeviceOffset.
 int getYAdvance()
          Getter for yAdvance.
 int getYAdvDevice()
          Getter for yAdvDeviceOffset.
 int getYPlacement()
          Getter for yPlacement.
 DeviceTable getYPlaDevice()
          Getter for yPlaDevice.
 int getYPlaDeviceOffset()
          Getter for yPlaDeviceOffset.
 void init(RandomAccessR rar, int posOffset)
          Initialize.
static boolean isMaskSet(int value, int mask)
          Check, if the bit for the mask is set.
 boolean isXAdvance()
          Getter for isXAdvance.
 boolean isXAdvDevice()
          Getter for isXAdvDevice.
 boolean isXPlacement()
          Getter for isXPlacement.
 boolean isXPlaDevice()
          Getter for isXPlaDevice.
 boolean isYAdvance()
          Getter for isYAdvance.
 boolean isYAdvDevice()
          Getter for isYAdvDevice.
 boolean isYPlacement()
          Getter for isYPlacement.
 boolean isYPlaDevice()
          Getter for isYPlaDevice.
 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
 

Field Detail

MASK

public static final int[] MASK
The MASK for the ValueFormat.


NAME

public static final java.lang.String[] NAME
The Name for the ValueFormat.


RESERVED

public static final int RESERVED
For future use.

See Also:
Constant Field Values

X_ADVANCE

public static final int X_ADVANCE
Includes horizontal adjustment for advance.

See Also:
Constant Field Values

X_ADV_DEVICE

public static final int X_ADV_DEVICE
Includes horizontal Device table for advance.

See Also:
Constant Field Values

X_PLACEMENT

public static final int X_PLACEMENT
Includes horizontal adjustment for placement.

See Also:
Constant Field Values

X_PLA_DEVICE

public static final int X_PLA_DEVICE
Includes horizontal Device table for placement.

See Also:
Constant Field Values

Y_ADVANCE

public static final int Y_ADVANCE
Includes vertical adjustment for advance.

See Also:
Constant Field Values

Y_ADV_DEVICE

public static final int Y_ADV_DEVICE
Includes vertical Device table for advance.

See Also:
Constant Field Values

Y_PLACEMENT

public static final int Y_PLACEMENT
Includes vertical adjustment for placement.

See Also:
Constant Field Values

Y_PLA_DEVICE

public static final int Y_PLA_DEVICE
Includes vertical Device table for placement.

See Also:
Constant Field Values
Constructor Detail

ValueRecord

public ValueRecord(RandomAccessR rar,
                   int posOffset,
                   XtfGlyphName xtfGlyph,
                   int valueFormat)
            throws java.io.IOException
Creates a new object.

Parameters:
rar - The input.
posOffset - The offset of the pos table.
xtfGlyph - The glyph name.
valueFormat - The ValueFormat.
Throws:
java.io.IOException - if a io-error occurred.
Method Detail

getMask

public static int getMask(int value)
Returns the mask of the ValueFormat or -1, if not found.

Parameters:
value - The value.
Returns:
Returns the mask of the ValueFormat or -1, if not found.

getMaskLength

public static int getMaskLength()
Returns the length of the mask array.

Returns:
Returns the length of the mask array.

getName

public static java.lang.String getName(int value)
Returns the name of the ValueFormat.

Parameters:
value - The value.
Returns:
Returns the name of the ValueFormat.

isMaskSet

public static boolean isMaskSet(int value,
                                int mask)
Check, if the bit for the mask is set.

Parameters:
value - The value.
mask - The mask.
Returns:
Returns true, if the bit for the mask is set, otherwise false.

getValueFormat

public int getValueFormat()
Getter for valueFormat.

Returns:
the valueFormat

getXAdvance

public int getXAdvance()
Getter for xAdvance.

Returns:
the xAdvance

getXAdvDevice

public DeviceTable getXAdvDevice()
Getter for xAdvDevice.

Returns:
the xAdvDevice

getXAdvDeviceOffset

public int getXAdvDeviceOffset()
Getter for xAdvDeviceOffset.

Returns:
the xAdvDeviceOffset

getXPlacement

public int getXPlacement()
Getter for xPlacement.

Returns:
the xPlacement

getXPlaDevice

public DeviceTable getXPlaDevice()
Getter for xPlaDevice.

Returns:
the xPlaDevice

getXPlaDeviceOffset

public int getXPlaDeviceOffset()
Getter for xPlaDeviceOffset.

Returns:
the xPlaDeviceOffset

getYAdvance

public int getYAdvance()
Getter for yAdvance.

Returns:
the yAdvance

getYAdvDevice

public int getYAdvDevice()
Getter for yAdvDeviceOffset.

Returns:
the yAdvDeviceOffset

getYPlacement

public int getYPlacement()
Getter for yPlacement.

Returns:
the yPlacement

getYPlaDevice

public DeviceTable getYPlaDevice()
Getter for yPlaDevice.

Returns:
the yPlaDevice

getYPlaDeviceOffset

public int getYPlaDeviceOffset()
Getter for yPlaDeviceOffset.

Returns:
the yPlaDeviceOffset

init

public void init(RandomAccessR rar,
                 int posOffset)
          throws java.io.IOException
Initialize.

Read the DeviceTable

Parameters:
rar - The input.
posOffset - The offset of the pos table.
Throws:
java.io.IOException - if a IO-error occurred.

isXAdvance

public boolean isXAdvance()
Getter for isXAdvance.

Returns:
the isXAdvance

isXAdvDevice

public boolean isXAdvDevice()
Getter for isXAdvDevice.

Returns:
the isXAdvDevice

isXPlacement

public boolean isXPlacement()
Getter for isXPlacement.

Returns:
the isXPlacement

isXPlaDevice

public boolean isXPlaDevice()
Getter for isXPlaDevice.

Returns:
the isXPlaDevice

isYAdvance

public boolean isYAdvance()
Getter for isYAdvance.

Returns:
the isYAdvance

isYAdvDevice

public boolean isYAdvDevice()
Getter for isYAdvDevice.

Returns:
the isYAdvDevice

isYPlacement

public boolean isYPlacement()
Getter for isYPlacement.

Returns:
the isYPlacement

isYPlaDevice

public boolean isYPlaDevice()
Getter for isYPlaDevice.

Returns:
the isYPlaDevice

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)