Class GlyphProcessingState
- java.lang.Object
-
- org.apache.fop.complexscripts.fonts.GlyphProcessingState
-
- Direct Known Subclasses:
GlyphPositioningState
,GlyphSubstitutionState
public class GlyphProcessingState extends java.lang.Object
The
GlyphProcessingState
implements a common, base state object used during glyph substitution and positioning processing.This work was originally authored by Glenn Adams (gadams@apache.org).
-
-
Field Summary
Fields Modifier and Type Field Description protected int
classMatchSet
class match setprotected int
consumed
consumed, updated after each successful subtable applicationprotected java.lang.String
feature
governing featureprotected GlyphContextTester
gct
glyph context tester or nullprotected GlyphDefinitionTable
gdef
governing glyph definition tableprotected GlyphTester
ignoreBase
ignore base glyph testerprotected GlyphTester
ignoreDefault
default ignore glyph testerprotected GlyphTester
ignoreLigature
ignore ligature glyph testerprotected GlyphTester
ignoreMark
ignore mark glyph testerprotected GlyphSequence
igs
current input glyph sequenceprotected int
index
current index in input sequenceprotected int
indexLast
last (maximum) index of input sequence (exclusive)protected java.lang.String
language
governing languageprotected int
lookupFlags
lookup flagsprotected java.lang.String
script
governing scriptprotected ScriptContextTester
sct
script specific context tester or null
-
Constructor Summary
Constructors Modifier Constructor Description GlyphProcessingState()
Construct default (reset) glyph processing state.protected
GlyphProcessingState(GlyphProcessingState s)
Construct glyph processing state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.protected
GlyphProcessingState(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, ScriptContextTester sct)
Construct glyph processing state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyDefault()
Apply default application semantices; namely, consume one glyph.int
consume(int count)
Record the consumption ofcount
glyphs such that this consumption never exceeds the number of glyphs in the input glyph sequence.boolean
didConsume()
Determine if any consumption has occurred.int
erase(int offset, int[] glyphs)
Erase glyphs in input glyph sequence starting at specified offset from current position, where each glyph in the specifiedglyphs
array is matched, one at a time, and when a (forward searching) match is found in the input glyph sequence, the matching glyph is replaced with the glyph index 65535.CharAssociation
getAssociation()
Obtain character association of glyph at current position.CharAssociation
getAssociation(int offset)
Obtain character association of glyph at specified offset from current position.CharAssociation[]
getAssociations(int offset, int count)
Obtaincount
character associations of glyphs starting at specified offset from current position.CharAssociation[]
getAssociations(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, CharAssociation[] associations, int[] counts)
Obtaincount
character associations of glyphs starting at specified offset from current position.int
getClassMatchSet(int gi)
Obtain governing class match set.GlyphTester
getCombinedAndTester(GlyphTester[] gta, int ngt)
Obtain an combined AND glyph tester.GlyphTester
getCombinedIgnoreTester(int flags)
Obtain an ignored glyph tester that corresponds to the specified multiple (combined) lookup flags.GlyphTester
getCombinedOrTester(GlyphTester[] gta, int ngt)
Obtain an combined OR glyph tester.GlyphDefinitionTable
getGDEF()
Obtain governing glyph definition table.int
getGlyph()
Obtain glyph at current position.int
getGlyph(int offset)
Obtain glyph at specified offset from current position.int[]
getGlyphs()
Obtain all glyphs starting from current position to end of input glyph sequence.int[]
getGlyphs(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, int[] glyphs, int[] counts)
Obtaincount
glyphs starting at specified offset from current position.int[]
getGlyphs(int offset, int count, int[] glyphs, int[] counts)
Obtaincount
glyphs starting at specified offset from current position.int[]
getGlyphsAvailable(int offset)
Determine number of glyphs available starting at specified offset from current position.int[]
getGlyphsAvailable(int offset, boolean reverseOrder)
Determine number of glyphs available starting at specified offset from current position.int[]
getGlyphsAvailable(int offset, boolean reverseOrder, GlyphTester ignoreTester)
Determine number of glyphs available starting at specified offset from current position.CharAssociation[]
getIgnoredAssociations(int offset, int count)
Obtaincount
character associations of ignored glyphs starting at specified offset from current position.CharAssociation[]
getIgnoredAssociations(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, CharAssociation[] associations, int[] counts)
Obtaincount
character associations of ignored glyphs starting at specified offset from current position.GlyphTester
getIgnoreDefault()
Obtain governing default ignores tester.int[]
getIgnoredGlyphs(int offset, int count)
Obtaincount
ignored glyphs starting at specified offset from current position.int[]
getIgnoredGlyphs(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, int[] glyphs, int[] counts)
Obtaincount
ignored glyphs starting at specified offset from current position.GlyphTester
getIgnoreTester(int flags)
Obtain an ignored glyph tester that corresponds to the specified lookup flags.GlyphSequence
getInput()
Obtain reference to input glyph sequence, which must not be modified.int
getLastPosition()
Obtain last valid position index in input glyph sequence.int
getLookupFlags()
Obtain governing lookup flags.int
getPosition()
Obtain current position index in input glyph sequence.boolean
hasNext()
Determine if at least one glyph remains in input sequence.boolean
hasNext(int count)
Determine if at leastcount
glyphs remain in input sequence.boolean
hasPrev()
Determine if at least one backtrack (previous) glyph is present in input sequence.boolean
hasPrev(int count)
Determine if at leastcount
backtrack (previous) glyphs are present in input sequence.boolean
isBase(int gi)
Determine if specified glyph is a base glyph according to the governing glyph definition table.boolean
isIgnoredBase(int gi, int flags)
Determine if specified glyph is an ignored base glyph according to the governing glyph definition table.boolean
isIgnoredGlyph()
Determine if glyph at current position is ignored.boolean
isIgnoredGlyph(int offset)
Determine if glyph at specified offset from current position is ignored.boolean
isIgnoredGlyph(int offset, GlyphTester ignoreTester)
Determine if glyph at specified offset from current position is ignored.boolean
isIgnoredLigature(int gi, int flags)
Determine if specified glyph is an ignored ligature glyph according to the governing glyph definition table.boolean
isIgnoredMark(int gi, int flags)
Determine if specified glyph is an ignored ligature glyph according to the governing glyph definition table.boolean
isLigature(int gi)
Determine if specified glyph is an ligature glyph according to the governing glyph definition table.boolean
isMark(int gi)
Determine if specified glyph is a mark glyph according to the governing glyph definition table.boolean
maybeApplicable()
Determine if is possible that the current input sequence satisfies a script specific context testing predicate.int
next()
Update the current position index based upon previously consumed glyphs, i.e., add the consuemd count to the current position index.int
prev()
Update the current position index based upon previously consumed glyphs, i.e., subtract the consuemd count from the current position index.boolean
replaceInput(int offset, int count, GlyphSequence gs)
Replace subsequence of input glyph sequence starting at specified offset from current position and of lengthcount
glyphs with all glyphs in the replacement sequencegs
.boolean
replaceInput(int offset, int count, GlyphSequence gs, int gsOffset, int gsCount)
Replace subsequence of input glyph sequence starting at specified offset from current position and of lengthcount
glyphs with a subsequence of the sequencegs
starting from the specified offsetgsOffset
of lengthgsCount
glyphs.protected GlyphProcessingState
reset(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, ScriptContextTester sct)
Reset glyph processing state.void
setGDEF(GlyphDefinitionTable gdef)
Set governing glyph definition table.void
setGlyph(int offset, int glyph)
Set (replace) glyph at specified offset from current position.void
setIgnoreDefault(GlyphTester ignoreDefault)
Set default ignore tester.void
setLookupFlags(int flags)
Set governing lookup flagsvoid
setPosition(int index)
Set (seek to) position index in input glyph sequence.void
updateSubtableState(GlyphSubtable st)
Update glyph subtable specific state.
-
-
-
Field Detail
-
gdef
protected GlyphDefinitionTable gdef
governing glyph definition table
-
script
protected java.lang.String script
governing script
-
language
protected java.lang.String language
governing language
-
feature
protected java.lang.String feature
governing feature
-
igs
protected GlyphSequence igs
current input glyph sequence
-
index
protected int index
current index in input sequence
-
indexLast
protected int indexLast
last (maximum) index of input sequence (exclusive)
-
consumed
protected int consumed
consumed, updated after each successful subtable application
-
lookupFlags
protected int lookupFlags
lookup flags
-
classMatchSet
protected int classMatchSet
class match set
-
sct
protected ScriptContextTester sct
script specific context tester or null
-
gct
protected GlyphContextTester gct
glyph context tester or null
-
ignoreBase
protected GlyphTester ignoreBase
ignore base glyph tester
-
ignoreLigature
protected GlyphTester ignoreLigature
ignore ligature glyph tester
-
ignoreMark
protected GlyphTester ignoreMark
ignore mark glyph tester
-
ignoreDefault
protected GlyphTester ignoreDefault
default ignore glyph tester
-
-
Constructor Detail
-
GlyphProcessingState
public GlyphProcessingState()
Construct default (reset) glyph processing state.
-
GlyphProcessingState
protected GlyphProcessingState(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, ScriptContextTester sct)
Construct glyph processing state.- Parameters:
gs
- input glyph sequencescript
- script identifierlanguage
- language identifierfeature
- feature identifiersct
- script context tester (or null)
-
GlyphProcessingState
protected GlyphProcessingState(GlyphProcessingState s)
Construct glyph processing state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.- Parameters:
s
- existing processing state to copy from
-
-
Method Detail
-
reset
protected GlyphProcessingState reset(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, ScriptContextTester sct)
Reset glyph processing state.- Parameters:
gs
- input glyph sequencescript
- script identifierlanguage
- language identifierfeature
- feature identifiersct
- script context tester (or null)- Returns:
- this instance
-
setGDEF
public void setGDEF(GlyphDefinitionTable gdef)
Set governing glyph definition table.- Parameters:
gdef
- glyph definition table (or null, to unset)
-
getGDEF
public GlyphDefinitionTable getGDEF()
Obtain governing glyph definition table.- Returns:
- glyph definition table (or null, to not set)
-
setLookupFlags
public void setLookupFlags(int flags)
Set governing lookup flags- Parameters:
flags
- lookup flags (or zero, to unset)
-
getLookupFlags
public int getLookupFlags()
Obtain governing lookup flags.- Returns:
- lookup flags (zero may indicate unset or no flags)
-
getClassMatchSet
public int getClassMatchSet(int gi)
Obtain governing class match set.- Parameters:
gi
- glyph index that may be used to determine which match set applies- Returns:
- class match set (zero may indicate unset or no set)
-
setIgnoreDefault
public void setIgnoreDefault(GlyphTester ignoreDefault)
Set default ignore tester.- Parameters:
ignoreDefault
- glyph tester (or null, to unset)
-
getIgnoreDefault
public GlyphTester getIgnoreDefault()
Obtain governing default ignores tester.- Returns:
- default ignores tester
-
updateSubtableState
public void updateSubtableState(GlyphSubtable st)
Update glyph subtable specific state. Each time a different glyph subtable is to be applied, it is used to update this state prior to application, after which this state is to be reset.- Parameters:
st
- glyph subtable to use for update
-
getPosition
public int getPosition()
Obtain current position index in input glyph sequence.- Returns:
- current index
-
setPosition
public void setPosition(int index) throws java.lang.IndexOutOfBoundsException
Set (seek to) position index in input glyph sequence.- Parameters:
index
- to seek to- Throws:
java.lang.IndexOutOfBoundsException
- if index is less than zero or exceeds last valid position
-
getLastPosition
public int getLastPosition()
Obtain last valid position index in input glyph sequence.- Returns:
- current last index
-
hasNext
public boolean hasNext()
Determine if at least one glyph remains in input sequence.- Returns:
- true if one or more glyph remains
-
hasNext
public boolean hasNext(int count)
Determine if at leastcount
glyphs remain in input sequence.- Parameters:
count
- of glyphs to test- Returns:
- true if at least
count
glyphs are available
-
next
public int next()
Update the current position index based upon previously consumed glyphs, i.e., add the consuemd count to the current position index. If no glyphs were previously consumed, then forces exactly one glyph to be consumed.- Returns:
- the new (updated) position index
-
hasPrev
public boolean hasPrev()
Determine if at least one backtrack (previous) glyph is present in input sequence.- Returns:
- true if one or more glyph remains
-
hasPrev
public boolean hasPrev(int count)
Determine if at leastcount
backtrack (previous) glyphs are present in input sequence.- Parameters:
count
- of glyphs to test- Returns:
- true if at least
count
glyphs are available
-
prev
public int prev()
Update the current position index based upon previously consumed glyphs, i.e., subtract the consuemd count from the current position index. If no glyphs were previously consumed, then forces exactly one glyph to be consumed. This method is used to traverse an input glyph sequence in reverse order.- Returns:
- the new (updated) position index
-
consume
public int consume(int count) throws java.lang.IndexOutOfBoundsException
Record the consumption ofcount
glyphs such that this consumption never exceeds the number of glyphs in the input glyph sequence.- Parameters:
count
- of glyphs to consume- Returns:
- newly adjusted consumption count
- Throws:
java.lang.IndexOutOfBoundsException
- if count would cause consumption to exceed count of glyphs in input glyph sequence
-
didConsume
public boolean didConsume()
Determine if any consumption has occurred.- Returns:
- true if consumption count is greater than zero
-
getInput
public GlyphSequence getInput()
Obtain reference to input glyph sequence, which must not be modified.- Returns:
- input glyph sequence
-
getGlyph
public int getGlyph(int offset) throws java.lang.IndexOutOfBoundsException
Obtain glyph at specified offset from current position.- Parameters:
offset
- from current position- Returns:
- glyph at specified offset from current position
- Throws:
java.lang.IndexOutOfBoundsException
- if no glyph available at offset
-
getGlyph
public int getGlyph() throws java.lang.IndexOutOfBoundsException
Obtain glyph at current position.- Returns:
- glyph at current position
- Throws:
java.lang.IndexOutOfBoundsException
- if no glyph available
-
setGlyph
public void setGlyph(int offset, int glyph) throws java.lang.IndexOutOfBoundsException
Set (replace) glyph at specified offset from current position.- Parameters:
offset
- from current positionglyph
- to set at specified offset from current position- Throws:
java.lang.IndexOutOfBoundsException
- if specified offset is not valid position
-
getAssociation
public CharAssociation getAssociation(int offset) throws java.lang.IndexOutOfBoundsException
Obtain character association of glyph at specified offset from current position.- Parameters:
offset
- from current position- Returns:
- character association of glyph at current position
- Throws:
java.lang.IndexOutOfBoundsException
- if offset results in an invalid index into input glyph sequence
-
getAssociation
public CharAssociation getAssociation() throws java.lang.IndexOutOfBoundsException
Obtain character association of glyph at current position.- Returns:
- character association of glyph at current position
- Throws:
java.lang.IndexOutOfBoundsException
- if no glyph available
-
getGlyphs
public int[] getGlyphs(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, int[] glyphs, int[] counts) throws java.lang.IndexOutOfBoundsException
Obtaincount
glyphs starting at specified offset from current position. IfreverseOrder
is true, then glyphs are returned in reverse order starting at specified offset and going in reverse towards beginning of input glyph sequence.- Parameters:
offset
- from current positioncount
- number of glyphs to obtainreverseOrder
- true if to obtain in reverse orderignoreTester
- glyph tester to use to determine which glyphs are ignored (or null, in which case none are ignored)glyphs
- array to use to fetch glyphscounts
- int[2] array to receive fetched glyph counts, where counts[0] will receive the number of glyphs obtained, and counts[1] will receive the number of glyphs ignored- Returns:
- array of glyphs
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getGlyphs
public int[] getGlyphs(int offset, int count, int[] glyphs, int[] counts) throws java.lang.IndexOutOfBoundsException
Obtaincount
glyphs starting at specified offset from current position. If offset is negative, then glyphs are returned in reverse order starting at specified offset and going in reverse towards beginning of input glyph sequence.- Parameters:
offset
- from current positioncount
- number of glyphs to obtainglyphs
- array to use to fetch glyphscounts
- int[2] array to receive fetched glyph counts, where counts[0] will receive the number of glyphs obtained, and counts[1] will receive the number of glyphs ignored- Returns:
- array of glyphs
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getGlyphs
public int[] getGlyphs() throws java.lang.IndexOutOfBoundsException
Obtain all glyphs starting from current position to end of input glyph sequence.- Returns:
- array of available glyphs
- Throws:
java.lang.IndexOutOfBoundsException
- if no glyph available
-
getIgnoredGlyphs
public int[] getIgnoredGlyphs(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, int[] glyphs, int[] counts) throws java.lang.IndexOutOfBoundsException
Obtaincount
ignored glyphs starting at specified offset from current position. IfreverseOrder
is true, then glyphs are returned in reverse order starting at specified offset and going in reverse towards beginning of input glyph sequence.- Parameters:
offset
- from current positioncount
- number of glyphs to obtainreverseOrder
- true if to obtain in reverse orderignoreTester
- glyph tester to use to determine which glyphs are ignored (or null, in which case none are ignored)glyphs
- array to use to fetch glyphscounts
- int[2] array to receive fetched glyph counts, where counts[0] will receive the number of glyphs obtained, and counts[1] will receive the number of glyphs ignored- Returns:
- array of glyphs
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getIgnoredGlyphs
public int[] getIgnoredGlyphs(int offset, int count) throws java.lang.IndexOutOfBoundsException
Obtaincount
ignored glyphs starting at specified offset from current position. Ifoffset
is negative, then fetch in reverse order.- Parameters:
offset
- from current positioncount
- number of glyphs to obtain- Returns:
- array of glyphs
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
isIgnoredGlyph
public boolean isIgnoredGlyph(int offset, GlyphTester ignoreTester) throws java.lang.IndexOutOfBoundsException
Determine if glyph at specified offset from current position is ignored. Ifoffset
is negative, then test in reverse order.- Parameters:
offset
- from current positionignoreTester
- glyph tester to use to determine which glyphs are ignored (or null, in which case none are ignored)- Returns:
- true if glyph is ignored
- Throws:
java.lang.IndexOutOfBoundsException
- if offset results in an invalid index into input glyph sequence
-
isIgnoredGlyph
public boolean isIgnoredGlyph(int offset) throws java.lang.IndexOutOfBoundsException
Determine if glyph at specified offset from current position is ignored. Ifoffset
is negative, then test in reverse order.- Parameters:
offset
- from current position- Returns:
- true if glyph is ignored
- Throws:
java.lang.IndexOutOfBoundsException
- if offset results in an invalid index into input glyph sequence
-
isIgnoredGlyph
public boolean isIgnoredGlyph() throws java.lang.IndexOutOfBoundsException
Determine if glyph at current position is ignored.- Returns:
- true if glyph is ignored
- Throws:
java.lang.IndexOutOfBoundsException
- if offset results in an invalid index into input glyph sequence
-
getGlyphsAvailable
public int[] getGlyphsAvailable(int offset, boolean reverseOrder, GlyphTester ignoreTester) throws java.lang.IndexOutOfBoundsException
Determine number of glyphs available starting at specified offset from current position. IfreverseOrder
is true, then search backwards in input glyph sequence.- Parameters:
offset
- from current positionreverseOrder
- true if to obtain in reverse orderignoreTester
- glyph tester to use to determine which glyphs to count (or null, in which case none are ignored)- Returns:
- an int[2] array where counts[0] is the number of glyphs available, and counts[1] is the number of glyphs ignored
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getGlyphsAvailable
public int[] getGlyphsAvailable(int offset, boolean reverseOrder) throws java.lang.IndexOutOfBoundsException
Determine number of glyphs available starting at specified offset from current position. IfreverseOrder
is true, then search backwards in input glyph sequence. Uses the default ignores tester.- Parameters:
offset
- from current positionreverseOrder
- true if to obtain in reverse order- Returns:
- an int[2] array where counts[0] is the number of glyphs available, and counts[1] is the number of glyphs ignored
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getGlyphsAvailable
public int[] getGlyphsAvailable(int offset) throws java.lang.IndexOutOfBoundsException
Determine number of glyphs available starting at specified offset from current position. If offset is negative, then search backwards in input glyph sequence. Uses the default ignores tester.- Parameters:
offset
- from current position- Returns:
- an int[2] array where counts[0] is the number of glyphs available, and counts[1] is the number of glyphs ignored
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getAssociations
public CharAssociation[] getAssociations(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, CharAssociation[] associations, int[] counts) throws java.lang.IndexOutOfBoundsException
Obtaincount
character associations of glyphs starting at specified offset from current position. IfreverseOrder
is true, then associations are returned in reverse order starting at specified offset and going in reverse towards beginning of input glyph sequence.- Parameters:
offset
- from current positioncount
- number of associations to obtainreverseOrder
- true if to obtain in reverse orderignoreTester
- glyph tester to use to determine which glyphs are ignored (or null, in which case none are ignored)associations
- array to use to fetch associationscounts
- int[2] array to receive fetched association counts, where counts[0] will receive the number of associations obtained, and counts[1] will receive the number of glyphs whose associations were ignored- Returns:
- array of associations
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getAssociations
public CharAssociation[] getAssociations(int offset, int count) throws java.lang.IndexOutOfBoundsException
Obtaincount
character associations of glyphs starting at specified offset from current position. If offset is negative, then search backwards in input glyph sequence. Uses the default ignores tester.- Parameters:
offset
- from current positioncount
- number of associations to obtain- Returns:
- array of associations
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getIgnoredAssociations
public CharAssociation[] getIgnoredAssociations(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, CharAssociation[] associations, int[] counts) throws java.lang.IndexOutOfBoundsException
Obtaincount
character associations of ignored glyphs starting at specified offset from current position. IfreverseOrder
is true, then glyphs are returned in reverse order starting at specified offset and going in reverse towards beginning of input glyph sequence.- Parameters:
offset
- from current positioncount
- number of character associations to obtainreverseOrder
- true if to obtain in reverse orderignoreTester
- glyph tester to use to determine which glyphs are ignored (or null, in which case none are ignored)associations
- array to use to fetch associationscounts
- int[2] array to receive fetched association counts, where counts[0] will receive the number of associations obtained, and counts[1] will receive the number of glyphs whose associations were ignored- Returns:
- array of associations
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
getIgnoredAssociations
public CharAssociation[] getIgnoredAssociations(int offset, int count) throws java.lang.IndexOutOfBoundsException
Obtaincount
character associations of ignored glyphs starting at specified offset from current position. If offset is negative, then search backwards in input glyph sequence. Uses the default ignores tester.- Parameters:
offset
- from current positioncount
- number of character associations to obtain- Returns:
- array of associations
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
replaceInput
public boolean replaceInput(int offset, int count, GlyphSequence gs, int gsOffset, int gsCount) throws java.lang.IndexOutOfBoundsException
Replace subsequence of input glyph sequence starting at specified offset from current position and of lengthcount
glyphs with a subsequence of the sequencegs
starting from the specified offsetgsOffset
of lengthgsCount
glyphs.- Parameters:
offset
- from current positioncount
- number of glyphs to replace, which, if negative means all glyphs from offset to end of input sequencegs
- glyph sequence from which to obtain replacement glyphsgsOffset
- offset of first glyph in replacement sequencegsCount
- count of glyphs in replacement sequence starting atgsOffset
- Returns:
- true if replacement occurred, or false if replacement would result in no change to input glyph sequence
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
replaceInput
public boolean replaceInput(int offset, int count, GlyphSequence gs) throws java.lang.IndexOutOfBoundsException
Replace subsequence of input glyph sequence starting at specified offset from current position and of lengthcount
glyphs with all glyphs in the replacement sequencegs
.- Parameters:
offset
- from current positioncount
- number of glyphs to replace, which, if negative means all glyphs from offset to end of input sequencegs
- glyph sequence from which to obtain replacement glyphs- Returns:
- true if replacement occurred, or false if replacement would result in no change to input glyph sequence
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
erase
public int erase(int offset, int[] glyphs) throws java.lang.IndexOutOfBoundsException
Erase glyphs in input glyph sequence starting at specified offset from current position, where each glyph in the specifiedglyphs
array is matched, one at a time, and when a (forward searching) match is found in the input glyph sequence, the matching glyph is replaced with the glyph index 65535.- Parameters:
offset
- from current positionglyphs
- array of glyphs to erase- Returns:
- the number of glyphs erased, which may be less than the number of specified glyphs
- Throws:
java.lang.IndexOutOfBoundsException
- if offset or count results in an invalid index into input glyph sequence
-
maybeApplicable
public boolean maybeApplicable()
Determine if is possible that the current input sequence satisfies a script specific context testing predicate. If no predicate applies, then application is always possible.- Returns:
- true if no script specific context tester applies or if a specified tester returns true for the current input sequence context
-
applyDefault
public void applyDefault()
Apply default application semantices; namely, consume one glyph.
-
isBase
public boolean isBase(int gi)
Determine if specified glyph is a base glyph according to the governing glyph definition table.- Parameters:
gi
- glyph index to test- Returns:
- true if glyph definition table records glyph as a base glyph; otherwise, false
-
isIgnoredBase
public boolean isIgnoredBase(int gi, int flags)
Determine if specified glyph is an ignored base glyph according to the governing glyph definition table.- Parameters:
gi
- glyph index to testflags
- that apply to lookup in scope- Returns:
- true if glyph definition table records glyph as a base glyph; otherwise, false
-
isLigature
public boolean isLigature(int gi)
Determine if specified glyph is an ligature glyph according to the governing glyph definition table.- Parameters:
gi
- glyph index to test- Returns:
- true if glyph definition table records glyph as a ligature glyph; otherwise, false
-
isIgnoredLigature
public boolean isIgnoredLigature(int gi, int flags)
Determine if specified glyph is an ignored ligature glyph according to the governing glyph definition table.- Parameters:
gi
- glyph index to testflags
- that apply to lookup in scope- Returns:
- true if glyph definition table records glyph as a ligature glyph; otherwise, false
-
isMark
public boolean isMark(int gi)
Determine if specified glyph is a mark glyph according to the governing glyph definition table.- Parameters:
gi
- glyph index to test- Returns:
- true if glyph definition table records glyph as a mark glyph; otherwise, false
-
isIgnoredMark
public boolean isIgnoredMark(int gi, int flags)
Determine if specified glyph is an ignored ligature glyph according to the governing glyph definition table.- Parameters:
gi
- glyph index to testflags
- that apply to lookup in scope- Returns:
- true if glyph definition table records glyph as a ligature glyph; otherwise, false
-
getIgnoreTester
public GlyphTester getIgnoreTester(int flags)
Obtain an ignored glyph tester that corresponds to the specified lookup flags.- Parameters:
flags
- lookup flags- Returns:
- a glyph tester
-
getCombinedIgnoreTester
public GlyphTester getCombinedIgnoreTester(int flags)
Obtain an ignored glyph tester that corresponds to the specified multiple (combined) lookup flags.- Parameters:
flags
- lookup flags- Returns:
- a glyph tester
-
getCombinedOrTester
public GlyphTester getCombinedOrTester(GlyphTester[] gta, int ngt)
Obtain an combined OR glyph tester.- Parameters:
gta
- an array of glyph testersngt
- number of glyph testers present in specified array- Returns:
- a combined OR glyph tester
-
getCombinedAndTester
public GlyphTester getCombinedAndTester(GlyphTester[] gta, int ngt)
Obtain an combined AND glyph tester.- Parameters:
gta
- an array of glyph testersngt
- number of glyph testers present in specified array- Returns:
- a combined AND glyph tester
-
-