Class GlyphPositioningState
java.lang.Object
org.apache.fop.complexscripts.fonts.GlyphProcessingState
org.apache.fop.complexscripts.fonts.GlyphPositioningState
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
ConstructorsConstructorDescriptionConstruct default (reset) glyph positioning state.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, String script, String language, String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct) Construct glyph positioning state. -
Method Summary
Modifier and TypeMethodDescriptionbooleanPerform adjustments at current position index.booleanadjust(GlyphPositioningTable.Value v, int offset) Perform adjustments at specified offset from current position index.booleanApply 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.voidApply default application semantices; namely, consume one input glyph.booleanGet adjusted state.int[]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.reset(GlyphSequence gs, String script, String language, 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 Details
-
GlyphPositioningState
public GlyphPositioningState()Construct default (reset) glyph positioning state. -
GlyphPositioningState
public GlyphPositioningState(GlyphSequence gs, String script, String language, 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
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 Details
-
reset
public GlyphPositioningState reset(GlyphSequence gs, String script, String language, 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
Perform adjustments at current position index.- Parameters:
v- value containing adjustments- Returns:
- true if a non-zero adjustment was made
-
adjust
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
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:
IndexOutOfBoundsException- if offset is invalid
-
apply
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
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.
-