org.apache.fop.complexscripts.scripts

## Class ScriptProcessor

- java.lang.Object
- - org.apache.fop.complexscripts.scripts.ScriptProcessor

- Direct Known Subclasses:
    DefaultScriptProcessor

      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).

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ScriptProcessor(java.lang.String script)` Instantiate a script processor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    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.
    `java.lang.CharSequence` | `preProcess(java.lang.CharSequence charSequence, MultiByteFont font, java.util.List associations)`
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ScriptProcessor

          protected ScriptProcessor(java.lang.String script)

      Instantiate a script processor.
      Parameters:
        `script` - a script identifier

  - ### Method Detail

    - #### getScript

          public final java.lang.String getScript()

      Returns:
        script identifier

    - #### getSubstitutionFeatures

          public abstract java.lang.String[] getSubstitutionFeatures()

      Obtain script specific required substitution features.
      Returns:
        array of suppported substitution features or null

    - #### getOptionalSubstitutionFeatures

          public java.lang.String[] getOptionalSubstitutionFeatures()

      Obtain script specific optional substitution features.
      Returns:
        array of suppported substitution features or null

    - #### getSubstitutionContextTester

          public abstract ScriptContextTester getSubstitutionContextTester()

      Obtain script specific substitution context tester.
      Returns:
        substitution context tester or null

    - #### substitute

          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)

      Perform substitution processing using a specific set of lookup tables.
      Parameters:
        `gsub` - the glyph substitution table that applies
        `gs` - an input glyph sequence
        `script` - a script identifier
        `language` - a language identifier
        `lookups` - 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,
                                          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.
      Parameters:
        `gs` - an input glyph sequence
        `script` - a script identifier
        `language` - a language identifier
        `usa` - an ordered array of glyph table use specs
        `sct` - 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,
                                                     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. 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 applies
        `gs` - an input glyph sequence
        `unscaledWidths` - associated unscaled advance widths (also reordered)
        `gpa` - associated glyph position adjustments (also reordered)
        `script` - a script identifier
        `language` - a language identifier
      Returns:
        the reordered (output) glyph sequence

    - #### getPositioningFeatures

          public abstract java.lang.String[] getPositioningFeatures()

      Obtain script specific required positioning features.
      Returns:
        array of suppported positioning features or null

    - #### getOptionalPositioningFeatures

          public java.lang.String[] getOptionalPositioningFeatures()

      Obtain script specific optional positioning features.
      Returns:
        array of suppported positioning features or null

    - #### getPositioningContextTester

          public abstract ScriptContextTester getPositioningContextTester()

      Obtain script specific positioning context tester.
      Returns:
        positioning context tester or null

    - #### position

          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)

      Perform positioning processing using a specific set of lookup tables.
      Parameters:
        `gpos` - the glyph positioning table that applies
        `gs` - an input glyph sequence
        `script` - a script identifier
        `language` - a language identifier
        `fontSize` - size in device units
        `lookups` - a mapping from lookup specifications to glyph subtables to use for positioning processing
        `widths` - array of default advancements for each glyph
        `adjustments` - 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,
                                  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.
      Parameters:
        `gs` - an input glyph sequence
        `script` - a script identifier
        `language` - a language identifier
        `fontSize` - size in device units
        `usa` - an ordered array of glyph table use specs
        `widths` - array of default advancements for each glyph in font
        `adjustments` - 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
        `sct` - 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,
                                                            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.
      Parameters:
        `table` - the governing glyph table
        `features` - array of feature identifiers to apply
        `lookups` - 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

          public static ScriptProcessor getInstance(java.lang.String script,
                                                    java.util.Map<java.lang.String,ScriptProcessor> processors)

      Obtain script processor instance associated with specified script.
      Parameters:
        `script` - a script identifier
      Returns:
        a script processor instance or null if none found

    - #### preProcess

          public java.lang.CharSequence preProcess(java.lang.CharSequence charSequence,
                                                   MultiByteFont font,
                                                   java.util.List associations)

Copyright 1999-2020 The Apache Software Foundation. All Rights Reserved.