org.apache.fop.complexscripts.scripts

## Class IndicScriptProcessor

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

- Direct Known Subclasses:
    DevanagariScriptProcessor, GujaratiScriptProcessor, GurmukhiScriptProcessor, KhmerScriptProcessor, TamilScriptProcessor

      public class IndicScriptProcessor
      extends DefaultScriptProcessor

  The `IndicScriptProcessor` class implements a script processor for performing glyph substitution and positioning operations on content associated with the Indic script.

  This work was originally authored by Glenn Adams (gadams@apache.org).

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `IndicScriptProcessor.DefaultSyllabizer` Default syllabizer.
    `protected static class` | `IndicScriptProcessor.Segment` Syllabic segment.
    `protected static class` | `IndicScriptProcessor.Syllabizer` Abstract syllabizer.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `findPreBaseMatra(GlyphSequence gs)` Find pre-base matra in sequence.
    `protected int` | `findPreBaseMatraTarget(GlyphSequence gs, int source)` Find pre-base matra target in sequence.
    `protected int` | `findReph(GlyphSequence gs)` Find reph in sequence.
    `protected int` | `findRephTarget(GlyphSequence gs, int source)` Find reph target in sequence.
    `String[]` | `getOptionalPositioningFeatures()` Obtain script specific optional positioning features.
    `String[]` | `getOptionalSubstitutionFeatures()` Obtain script specific optional substitution features.
    `ScriptContextTester` | `getPositioningContextTester()` Obtain script specific positioning context tester.
    `String[]` | `getPositioningFeatures()` Obtain script specific required positioning features.
    `ScriptContextTester` | `getSubstitutionContextTester()` Obtain script specific substitution context tester.
    `String[]` | `getSubstitutionFeatures()` Obtain script specific required substitution features.
    `protected Class<? extends IndicScriptProcessor.Syllabizer>` | `getSyllabizerClass()` Get script specific syllabizer class.
    `static ScriptProcessor` | `makeProcessor(String script)` Make script specific flavor of Indic script processor.
    `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.
    `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.

    - ### Methods inherited from class org.apache.fop.complexscripts.scripts.DefaultScriptProcessor

      `isReorderedMark, reorderCombiningMarks`

    - ### Methods inherited from class org.apache.fop.complexscripts.scripts.ScriptProcessor

      `assembleLookups, getInstance, getScript, position, preProcess, substitute`

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

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

- - ### Method Detail

    - #### makeProcessor

          public static ScriptProcessor makeProcessor(String script)

      Make script specific flavor of Indic script processor.
      Parameters:
        `script` - tag
      Returns:
        script processor instance

    - #### getSubstitutionFeatures

          public String[] getSubstitutionFeatures()

      Obtain script specific required substitution features.
      Overrides:
        `getSubstitutionFeatures` in class `DefaultScriptProcessor`
      Returns:
        array of suppported substitution features or null

    - #### getOptionalSubstitutionFeatures

          public String[] getOptionalSubstitutionFeatures()

      Obtain script specific optional substitution features.
      Overrides:
        `getOptionalSubstitutionFeatures` in class `ScriptProcessor`
      Returns:
        array of suppported substitution features or null

    - #### getSubstitutionContextTester

          public ScriptContextTester getSubstitutionContextTester()

      Obtain script specific substitution context tester.
      Overrides:
        `getSubstitutionContextTester` in class `DefaultScriptProcessor`
      Returns:
        substitution context tester or null

    - #### getPositioningFeatures

          public String[] getPositioningFeatures()

      Obtain script specific required positioning features.
      Overrides:
        `getPositioningFeatures` in class `DefaultScriptProcessor`
      Returns:
        array of suppported positioning features or null

    - #### getOptionalPositioningFeatures

          public String[] getOptionalPositioningFeatures()

      Obtain script specific optional positioning features.
      Overrides:
        `getOptionalPositioningFeatures` in class `ScriptProcessor`
      Returns:
        array of suppported positioning features or null

    - #### getPositioningContextTester

          public ScriptContextTester getPositioningContextTester()

      Obtain script specific positioning context tester.
      Overrides:
        `getPositioningContextTester` in class `DefaultScriptProcessor`
      Returns:
        positioning context tester or null

    - #### 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.
      Overrides:
        `substitute` in class `ScriptProcessor`
      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

    - #### getSyllabizerClass

          protected Class<? extends IndicScriptProcessor.Syllabizer> getSyllabizerClass()

      Get script specific syllabizer class.
      Returns:
        a syllabizer class object or null

    - #### findPreBaseMatra

          protected int findPreBaseMatra(GlyphSequence gs)

      Find pre-base matra in sequence.
      Parameters:
        `gs` - input sequence
      Returns:
        index of pre-base matra or -1 if not found

    - #### findPreBaseMatraTarget

          protected int findPreBaseMatraTarget(GlyphSequence gs,
                                               int source)

      Find pre-base matra target in sequence.
      Parameters:
        `gs` - input sequence
        `source` - index of pre-base matra
      Returns:
        index of pre-base matra target or -1

    - #### findReph

          protected int findReph(GlyphSequence gs)

      Find reph in sequence.
      Parameters:
        `gs` - input sequence
      Returns:
        index of reph or -1 if not found

    - #### findRephTarget

          protected int findRephTarget(GlyphSequence gs,
                                       int source)

      Find reph target in sequence.
      Parameters:
        `gs` - input sequence
        `source` - index of reph
      Returns:
        index of reph target or -1

    - #### 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.
      Overrides:
        `position` in class `ScriptProcessor`
      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

Copyright © 2023 Apache Software Foundation. All rights reserved.