Class GlyphSubstitutionState
java.lang.Object
org.apache.fop.complexscripts.fonts.GlyphProcessingState
org.apache.fop.complexscripts.fonts.GlyphSubstitutionState
The GlyphSubstitutionState
implements an state object used during glyph substitution
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 substitution state.Construct glyph substitution state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.GlyphSubstitutionState
(GlyphSequence gs, String script, String language, String feature, ScriptContextTester sct) Construct glyph substitution state. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Apply substitution subtable to current state at current position (only), resulting in the consumption of zero or more input glyphs, and possibly replacing the current input glyphs starting at the current position, in which case it is possible that indexLast is altered to be either less than or greater than its value prior to this application.boolean
apply
(GlyphTable.RuleLookup[] lookups, int nig) Apply a sequence of matched rule lookups to thenig
input glyphs starting at the current position.void
Apply default application semantices; namely, consume one input glyph, writing that glyph (and its association) to the output glyphs (and associations).int
getAlternatesIndex
(int ci) Obtain alternates index associated with specified coverage index.Obtain output glyph sequence.void
putGlyph
(int glyph, CharAssociation a, Object predication) Put (write) glyph into glyph output buffer.void
putGlyphs
(int[] glyphs, CharAssociation[] associations, Object predication) Put (write) array of glyphs into glyph output buffer.reset
(GlyphSequence gs, String script, String language, String feature, ScriptContextTester sct) Reset glyph substitution state.void
setAlternates
(int[] alternates) Set alternates indices.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, setGDEF, setGlyph, setIgnoreDefault, setLookupFlags, setPosition, updateSubtableState
-
Constructor Details
-
GlyphSubstitutionState
public GlyphSubstitutionState()Construct default (reset) glyph substitution state. -
GlyphSubstitutionState
public GlyphSubstitutionState(GlyphSequence gs, String script, String language, String feature, ScriptContextTester sct) Construct glyph substitution state.- Parameters:
gs
- input glyph sequencescript
- script identifierlanguage
- language identifierfeature
- feature identifiersct
- script context tester (or null)
-
GlyphSubstitutionState
Construct glyph substitution state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.- Parameters:
ss
- existing positioning state to copy from
-
-
Method Details
-
reset
public GlyphSubstitutionState reset(GlyphSequence gs, String script, String language, String feature, ScriptContextTester sct) Reset glyph substitution state.- Overrides:
reset
in classGlyphProcessingState
- Parameters:
gs
- input glyph sequencescript
- script identifierlanguage
- language identifierfeature
- feature identifiersct
- script context tester (or null)- Returns:
- this instance
-
setAlternates
public void setAlternates(int[] alternates) Set alternates indices.- Parameters:
alternates
- array of alternates indices ordered by coverage index
-
getAlternatesIndex
public int getAlternatesIndex(int ci) Obtain alternates index associated with specified coverage index. An alternates index is used to select among stylistic alternates of a glyph at a particular coverage index. This information must be provided by the document itself (in the form of an extension attribute value), since a font has no way to determine which alternate the user desires.- Parameters:
ci
- coverage index- Returns:
- an alternates index
-
putGlyph
Put (write) glyph into glyph output buffer.- Parameters:
glyph
- to writea
- character association that applies to glyphpredication
- a predication value to add to association A if predications enabled
-
putGlyphs
Put (write) array of glyphs into glyph output buffer.- Parameters:
glyphs
- to writeassociations
- array of character associations that apply to glyphspredication
- optional predicaion object to be associated with glyphs' associations
-
getOutput
Obtain output glyph sequence.- Returns:
- newly constructed glyph sequence comprised of original characters, output glyphs, and output associations
-
apply
Apply substitution subtable to current state at current position (only), resulting in the consumption of zero or more input glyphs, and possibly replacing the current input glyphs starting at the current position, in which case it is possible that indexLast is altered to be either less than or greater than its value prior to this application.- Parameters:
st
- the glyph substitution 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 thenig
input glyphs starting at the current position. If lookups are non-null and non-empty, then all input glyphs specified bynig
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, writing that glyph (and its association) to the output glyphs (and associations).- Overrides:
applyDefault
in classGlyphProcessingState
-