Class ScriptProcessor
java.lang.Object
org.apache.fop.complexscripts.scripts.ScriptProcessor
- Direct Known Subclasses:
DefaultScriptProcessor
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).
-
Constructor Summary
ModifierConstructorDescriptionprotected
ScriptProcessor
(String script) Instantiate a script processor. -
Method Summary
Modifier and TypeMethodDescriptionfinal GlyphTable.UseSpec[]
assembleLookups
(GlyphTable table, String[] features, Map<GlyphTable.LookupSpec, 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
(String script, Map<String, ScriptProcessor> processors) Obtain script processor instance associated with specified script.String[]
Obtain script specific optional positioning features.String[]
Obtain script specific optional substitution features.abstract ScriptContextTester
Obtain script specific positioning context tester.abstract String[]
Obtain script specific required positioning features.final String
abstract ScriptContextTester
Obtain script specific substitution context tester.abstract String[]
Obtain script specific required substitution features.final boolean
position
(GlyphPositioningTable gpos, GlyphSequence gs, String script, String language, int fontSize, Map<GlyphTable.LookupSpec, List<GlyphTable.LookupTable>> lookups, int[] widths, int[][] adjustments) Perform positioning processing using a specific set of lookup tables.boolean
position
(GlyphSequence gs, String script, 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.preProcess
(CharSequence charSequence, MultiByteFont font, List associations) reorderCombiningMarks
(GlyphDefinitionTable gdef, GlyphSequence gs, int[] unscaledWidths, int[][] gpa, String script, String language) Reorder combining marks in glyph sequence so that they precede (within the sequence) the base character to which they are applied.final GlyphSequence
substitute
(GlyphSubstitutionTable gsub, GlyphSequence gs, String script, String language, Map<GlyphTable.LookupSpec, List<GlyphTable.LookupTable>> lookups) Perform substitution processing using a specific set of lookup tables.substitute
(GlyphSequence gs, String script, String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct) Perform substitution processing using a specific set of ordered glyph table use specifications.
-
Constructor Details
-
ScriptProcessor
Instantiate a script processor.- Parameters:
script
- a script identifier
-
-
Method Details
-
getScript
- Returns:
- script identifier
-
getSubstitutionFeatures
Obtain script specific required substitution features.- Returns:
- array of suppported substitution features or null
-
getOptionalSubstitutionFeatures
Obtain script specific optional substitution features.- Returns:
- array of suppported substitution features or null
-
getSubstitutionContextTester
Obtain script specific substitution context tester.- Returns:
- substitution context tester or null
-
substitute
public final GlyphSequence substitute(GlyphSubstitutionTable gsub, GlyphSequence gs, String script, String language, Map<GlyphTable.LookupSpec, List<GlyphTable.LookupTable>> lookups) Perform substitution processing using a specific set of lookup tables.- Parameters:
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 processing- Returns:
- the substituted (output) glyph sequence
-
substitute
public GlyphSequence substitute(GlyphSequence gs, String script, String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct) Perform substitution processing using a specific set of ordered glyph table use specifications.- Parameters:
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)- Returns:
- the substituted (output) glyph sequence
-
reorderCombiningMarks
public GlyphSequence reorderCombiningMarks(GlyphDefinitionTable gdef, GlyphSequence gs, int[] unscaledWidths, int[][] gpa, String script, String language) Reorder combining marks in glyph sequence so that they precede (within the sequence) the base character to which they are applied. N.B. In the case of RTL segments, marks are not reordered by this, method since when the segment is reversed by BIDI processing, marks are automatically reordered to precede their base glyph.- Parameters:
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 identifier- Returns:
- the reordered (output) glyph sequence
-
getPositioningFeatures
Obtain script specific required positioning features.- Returns:
- array of suppported positioning features or null
-
getOptionalPositioningFeatures
Obtain script specific optional positioning features.- Returns:
- array of suppported positioning features or null
-
getPositioningContextTester
Obtain script specific positioning context tester.- Returns:
- positioning context tester or null
-
position
public final boolean position(GlyphPositioningTable gpos, GlyphSequence gs, String script, String language, int fontSize, Map<GlyphTable.LookupSpec, List<GlyphTable.LookupTable>> lookups, int[] widths, int[][] adjustments) Perform positioning processing using a specific set of lookup tables.- Parameters:
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 sequence- Returns:
- true if some adjustment is not zero; otherwise, false
-
position
public boolean position(GlyphSequence gs, String script, 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.- Parameters:
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)- Returns:
- true if some adjustment is not zero; otherwise, false
-
assembleLookups
public final GlyphTable.UseSpec[] assembleLookups(GlyphTable table, String[] features, Map<GlyphTable.LookupSpec, 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.- Parameters:
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 features- Returns:
- ordered array of assembled lookup table use specifications
-
getInstance
Obtain script processor instance associated with specified script.- Parameters:
script
- a script identifier- Returns:
- a script processor instance or null if none found
-
preProcess
-