fop 1.1

org.apache.fop.complexscripts.fonts
Class GlyphPositioningState

java.lang.Object
  extended by org.apache.fop.complexscripts.fonts.GlyphProcessingState
      extended by org.apache.fop.complexscripts.fonts.GlyphPositioningState

public class GlyphPositioningState
extends GlyphProcessingState

The GlyphPositioningState implements an state object used during glyph positioning processing.

This work was originally authored by Glenn Adams (gadams@apache.org).


Field Summary
 
Fields inherited from class org.apache.fop.complexscripts.fonts.GlyphProcessingState
classMatchSet, consumed, feature, gct, gdef, ignoreBase, ignoreDefault, ignoreLigature, ignoreMark, igs, index, indexLast, language, lookupFlags, script, sct
 
Constructor Summary
GlyphPositioningState(GlyphPositioningState ps)
          Construct glyph positioning state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.
GlyphPositioningState(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct)
          Construct glyph positioning state.
 
Method Summary
 boolean adjust(GlyphPositioningTable.Value v)
          Perform adjustments at current position index.
 boolean adjust(GlyphPositioningTable.Value v, int offset)
          Perform adjustments at specified offset from current position index.
 boolean apply(GlyphPositioningSubtable st)
          Apply positioning subtable to current state at current position (only), resulting in the consumption of zero or more input glyphs.
 boolean apply(GlyphTable.RuleLookup[] lookups, int nig)
          Apply a sequence of matched rule lookups to the nig input glyphs starting at the current position.
 void applyDefault()
          Apply default application semantices; namely, consume one input glyph.
 boolean getAdjusted()
          Get adjusted state.
 int[] getAdjustment()
          Obtain current adjustments at current position index.
 int[] getAdjustment(int offset)
          Obtain current adjustments at specified offset from current position index.
 int getWidth(int gi)
          Obtain design advancement (width) of glyph at specified index.
 void setAdjusted(boolean adjusted)
          Set adjusted state, used to record effect of non-zero adjustment.
 
Methods inherited from class org.apache.fop.complexscripts.fonts.GlyphProcessingState
consume, didConsume, erase, getAssociation, getAssociation, getAssociations, getAssociations, getClassMatchSet, getCombinedAndTester, getCombinedIgnoreTester, getCombinedOrTester, getGDEF, getGlyph, getGlyph, getGlyphs, getGlyphs, getGlyphs, getGlyphsAvailable, getGlyphsAvailable, getGlyphsAvailable, getIgnoredAssociations, getIgnoredAssociations, getIgnoreDefault, getIgnoredGlyphs, getIgnoredGlyphs, getIgnoreTester, getInput, getLastPosition, getLookupFlags, getPosition, hasNext, hasNext, hasPrev, hasPrev, isBase, isIgnoredBase, isIgnoredLigature, isIgnoredMark, isLigature, isMark, maybeApplicable, next, prev, replaceInput, replaceInput, resetSubtableState, setGDEF, setGlyph, setIgnoreDefault, setLookupFlags, setPosition, updateSubtableState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlyphPositioningState

public GlyphPositioningState(GlyphSequence gs,
                             java.lang.String script,
                             java.lang.String language,
                             java.lang.String feature,
                             int fontSize,
                             int[] widths,
                             int[][] adjustments,
                             ScriptContextTester sct)
Construct glyph positioning state.

Parameters:
gs - input glyph sequence
script - script identifier
language - language identifier
feature - feature identifier
fontSize - font size (in micropoints)
widths - array of design advancements (in glyph index order)
adjustments - positioning adjustments to which positioning is applied
sct - script context tester (or null)

GlyphPositioningState

public GlyphPositioningState(GlyphPositioningState ps)
Construct glyph positioning state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.

Parameters:
ps - existing positioning state to copy from
Method Detail

getWidth

public int getWidth(int gi)
Obtain design advancement (width) of glyph at specified index.

Parameters:
gi - glyph index
Returns:
design advancement, or zero if glyph index is not present

adjust

public boolean adjust(GlyphPositioningTable.Value v)
Perform adjustments at current position index.

Parameters:
v - value containing adjustments
Returns:
true if a non-zero adjustment was made

adjust

public boolean adjust(GlyphPositioningTable.Value v,
                      int offset)
Perform adjustments at specified offset from current position index.

Parameters:
v - value containing adjustments
offset - from current position index
Returns:
true if a non-zero adjustment was made

getAdjustment

public int[] getAdjustment()
Obtain current adjustments at current position index.

Returns:
array of adjustments (int[4]) at current position

getAdjustment

public int[] getAdjustment(int offset)
                    throws java.lang.IndexOutOfBoundsException
Obtain current adjustments at specified offset from current position index.

Parameters:
offset - from current position index
Returns:
array of adjustments (int[4]) at specified offset
Throws:
java.lang.IndexOutOfBoundsException - if offset is invalid

apply

public boolean apply(GlyphPositioningSubtable st)
Apply positioning subtable to current state at current position (only), resulting in the consumption of zero or more input glyphs.

Parameters:
st - the glyph positioning subtable to apply
Returns:
true if subtable applied, or false if it did not (e.g., its input coverage table did not match current input context)

apply

public boolean apply(GlyphTable.RuleLookup[] lookups,
                     int nig)
Apply a sequence of matched rule lookups to the nig input glyphs starting at the current position. If lookups are non-null and non-empty, then all input glyphs specified by nig are consumed irregardless of whether any specified lookup applied.

Parameters:
lookups - array of matched lookups (or null)
nig - number of glyphs in input sequence, starting at current position, to which the lookups are to apply, and to be consumed once the application has finished
Returns:
true if lookups are non-null and non-empty; otherwise, false

applyDefault

public void applyDefault()
Apply default application semantices; namely, consume one input glyph.

Overrides:
applyDefault in class GlyphProcessingState

setAdjusted

public void setAdjusted(boolean adjusted)
Set adjusted state, used to record effect of non-zero adjustment.

Parameters:
adjusted - true if to set adjusted state, otherwise false to clear adjusted state

getAdjusted

public boolean getAdjusted()
Get adjusted state.

Returns:
adjusted true if some non-zero adjustment occurred and was recorded by setAdjusted(boolean); otherwise, false.

fop 1.1

Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.