public abstract class ScriptProcessor
extends java.lang.Object
Abstract script processor base class for which an implementation of the substitution and positioning methods must be supplied.
This work was originally authored by Glenn Adams (gadams@apache.org).
Modifier | Constructor and Description |
---|---|
protected |
ScriptProcessor(java.lang.String script)
Instantiate a script processor.
|
Modifier and Type | Method and Description |
---|---|
GlyphTable.UseSpec[] |
assembleLookups(GlyphTable table,
java.lang.String[] features,
java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups)
Assemble ordered array of lookup table use specifications according to the specified features and candidate lookups,
where the order of the array is in accordance to the order of the applicable lookup list.
|
static ScriptProcessor |
getInstance(java.lang.String script,
java.util.Map<java.lang.String,ScriptProcessor> processors)
Obtain script processor instance associated with specified script.
|
java.lang.String[] |
getOptionalPositioningFeatures()
Obtain script specific optional positioning features.
|
java.lang.String[] |
getOptionalSubstitutionFeatures()
Obtain script specific optional substitution features.
|
abstract ScriptContextTester |
getPositioningContextTester()
Obtain script specific positioning context tester.
|
abstract java.lang.String[] |
getPositioningFeatures()
Obtain script specific required positioning features.
|
java.lang.String |
getScript() |
abstract ScriptContextTester |
getSubstitutionContextTester()
Obtain script specific substitution context tester.
|
abstract java.lang.String[] |
getSubstitutionFeatures()
Obtain script specific required substitution features.
|
boolean |
position(GlyphPositioningTable gpos,
GlyphSequence gs,
java.lang.String script,
java.lang.String language,
int fontSize,
java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups,
int[] widths,
int[][] adjustments)
Perform positioning processing using a specific set of lookup tables.
|
boolean |
position(GlyphSequence gs,
java.lang.String script,
java.lang.String language,
int fontSize,
GlyphTable.UseSpec[] usa,
int[] widths,
int[][] adjustments,
ScriptContextTester sct)
Perform positioning processing using a specific set of ordered glyph table use specifications.
|
GlyphSequence |
reorderCombiningMarks(GlyphDefinitionTable gdef,
GlyphSequence gs,
int[] unscaledWidths,
int[][] gpa,
java.lang.String script,
java.lang.String language)
Reorder combining marks in glyph sequence so that they precede (within the sequence) the base
character to which they are applied.
|
GlyphSequence |
substitute(GlyphSequence gs,
java.lang.String script,
java.lang.String language,
GlyphTable.UseSpec[] usa,
ScriptContextTester sct)
Perform substitution processing using a specific set of ordered glyph table use specifications.
|
GlyphSequence |
substitute(GlyphSubstitutionTable gsub,
GlyphSequence gs,
java.lang.String script,
java.lang.String language,
java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups)
Perform substitution processing using a specific set of lookup tables.
|
protected ScriptProcessor(java.lang.String script)
script
- a script identifierpublic final java.lang.String getScript()
public abstract java.lang.String[] getSubstitutionFeatures()
public java.lang.String[] getOptionalSubstitutionFeatures()
public abstract ScriptContextTester getSubstitutionContextTester()
public final GlyphSequence substitute(GlyphSubstitutionTable gsub, GlyphSequence gs, java.lang.String script, java.lang.String language, java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups)
gsub
- the glyph substitution table that appliesgs
- an input glyph sequencescript
- a script identifierlanguage
- a language identifierlookups
- a mapping from lookup specifications to glyph subtables to use for substitution processingpublic GlyphSequence substitute(GlyphSequence gs, java.lang.String script, java.lang.String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct)
gs
- an input glyph sequencescript
- a script identifierlanguage
- a language identifierusa
- an ordered array of glyph table use specssct
- a script specific context tester (or null)public GlyphSequence reorderCombiningMarks(GlyphDefinitionTable gdef, GlyphSequence gs, int[] unscaledWidths, int[][] gpa, java.lang.String script, java.lang.String language)
gdef
- the glyph definition table that appliesgs
- an input glyph sequenceunscaledWidths
- associated unscaled advance widths (also reordered)gpa
- associated glyph position adjustments (also reordered)script
- a script identifierlanguage
- a language identifierpublic abstract java.lang.String[] getPositioningFeatures()
public java.lang.String[] getOptionalPositioningFeatures()
public abstract ScriptContextTester getPositioningContextTester()
public final boolean position(GlyphPositioningTable gpos, GlyphSequence gs, java.lang.String script, java.lang.String language, int fontSize, java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups, int[] widths, int[][] adjustments)
gpos
- the glyph positioning table that appliesgs
- an input glyph sequencescript
- a script identifierlanguage
- a language identifierfontSize
- size in device unitslookups
- a mapping from lookup specifications to glyph subtables to use for positioning processingwidths
- array of default advancements for each glyphadjustments
- accumulated adjustments array (sequence) of 4-tuples of placement [PX,PY] and advance [AX,AY] adjustments, in that order,
with one 4-tuple for each element of glyph sequencepublic boolean position(GlyphSequence gs, java.lang.String script, java.lang.String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct)
gs
- an input glyph sequencescript
- a script identifierlanguage
- a language identifierfontSize
- size in device unitsusa
- an ordered array of glyph table use specswidths
- array of default advancements for each glyph in fontadjustments
- accumulated adjustments array (sequence) of 4-tuples of placement [PX,PY] and advance [AX,AY] adjustments, in that order,
with one 4-tuple for each element of glyph sequencesct
- a script specific context tester (or null)public final GlyphTable.UseSpec[] assembleLookups(GlyphTable table, java.lang.String[] features, java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups)
table
- the governing glyph tablefeatures
- array of feature identifiers to applylookups
- a mapping from lookup specifications to lists of look tables from which to select lookup tables according to the specified featurespublic static ScriptProcessor getInstance(java.lang.String script, java.util.Map<java.lang.String,ScriptProcessor> processors)
script
- a script identifierCopyright 1999-2017 The Apache Software Foundation. All Rights Reserved.