Class GlyphPositioningState
- java.lang.Object
-
- org.apache.fop.complexscripts.fonts.GlyphProcessingState
-
- org.apache.fop.complexscripts.fonts.GlyphPositioningState
-
public class GlyphPositioningState extends GlyphProcessingState
The
GlyphPositioningStateimplements 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
Constructors Constructor Description GlyphPositioningState()Construct default (reset) glyph positioning state.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadjust(GlyphPositioningTable.Value v)Perform adjustments at current position index.booleanadjust(GlyphPositioningTable.Value v, int offset)Perform adjustments at specified offset from current position index.booleanapply(GlyphPositioningSubtable st)Apply positioning subtable to current state at current position (only), resulting in the consumption of zero or more input glyphs.booleanapply(GlyphTable.RuleLookup[] lookups, int nig)Apply a sequence of matched rule lookups to theniginput glyphs starting at the current position.voidapplyDefault()Apply default application semantices; namely, consume one input glyph.booleangetAdjusted()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.intgetWidth(int gi)Obtain design advancement (width) of glyph at specified index.GlyphPositioningStatereset(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct)Reset glyph positioning state.voidsetAdjusted(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, getUnprocessedGlyph, hasNext, hasNext, hasPrev, hasPrev, isBase, isIgnoredBase, isIgnoredGlyph, isIgnoredGlyph, isIgnoredGlyph, isIgnoredLigature, isIgnoredMark, isLigature, isMark, maybeApplicable, next, prev, replaceInput, replaceInput, reset, setGDEF, setGlyph, setIgnoreDefault, setLookupFlags, setPosition, updateSubtableState
-
-
-
-
Constructor Detail
-
GlyphPositioningState
public GlyphPositioningState()
Construct default (reset) glyph positioning state.
-
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 sequencescript- script identifierlanguage- language identifierfeature- feature identifierfontSize- font size (in micropoints)widths- array of design advancements (in glyph index order)adjustments- positioning adjustments to which positioning is appliedsct- 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
-
reset
public GlyphPositioningState reset(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct)
Reset glyph positioning state.- Parameters:
gs- input glyph sequencescript- script identifierlanguage- language identifierfeature- feature identifierfontSize- font size (in micropoints)widths- array of design advancements (in glyph index order)adjustments- positioning adjustments to which positioning is appliedsct- script context tester (or null)
-
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 adjustmentsoffset- 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.IndexOutOfBoundsExceptionObtain 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 theniginput glyphs starting at the current position. If lookups are non-null and non-empty, then all input glyphs specified bynigare 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:
applyDefaultin classGlyphProcessingState
-
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.
-
-