org.apache.fop.complexscripts.fonts

## Class GlyphPositioningState

- java.lang.Object
- - org.apache.fop.complexscripts.fonts.GlyphProcessingState
  - - org.apache.fop.complexscripts.fonts.GlyphPositioningState

-     public class GlyphPositioningState
      extends GlyphProcessingState

  The `GlyphPositioningState` implements an state object used during glyph positioning processing.

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

- - ### Field Summary

    - ### Fields inherited from class org.apache.fop.complexscripts.fonts.GlyphProcessingState

      `classMatchSet, consumed, feature, gct, gdef, ignoreBase, ignoreDefault, ignoreLigature, ignoreMark, igs, index, indexLast, language, lookupFlags, script, sct`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GlyphPositioningState()` Construct default (reset) glyph positioning state.
    `GlyphPositioningState(GlyphPositioningState ps)` Construct glyph positioning state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.
    `GlyphPositioningState(GlyphSequence gs, String script, String language, String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct)` Construct glyph positioning state.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `adjust(GlyphPositioningTable.Value v)` Perform adjustments at current position index.
    `boolean` | `adjust(GlyphPositioningTable.Value v, int offset)` Perform adjustments at specified offset from current position index.
    `boolean` | `apply(GlyphPositioningSubtable st)` Apply positioning subtable to current state at current position (only), resulting in the consumption of zero or more input glyphs.
    `boolean` | `apply(GlyphTable.RuleLookup[] lookups, int nig)` Apply a sequence of matched rule lookups to the `nig` input glyphs starting at the current position.
    `void` | `applyDefault()` Apply default application semantices; namely, consume one input glyph.
    `boolean` | `getAdjusted()` Get adjusted state.
    `int[]` | `getAdjustment()` Obtain current adjustments at current position index.
    `int[]` | `getAdjustment(int offset)` Obtain current adjustments at specified offset from current position index.
    `int` | `getWidth(int gi)` Obtain design advancement (width) of glyph at specified index.
    `GlyphPositioningState` | `reset(GlyphSequence gs, String script, String language, String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct)` Reset glyph positioning state.
    `void` | `setAdjusted(boolean adjusted)` Set adjusted state, used to record effect of non-zero adjustment.

    - ### Methods inherited from class org.apache.fop.complexscripts.fonts.GlyphProcessingState

      `consume, didConsume, erase, getAssociation, getAssociation, getAssociations, getAssociations, getClassMatchSet, getCombinedAndTester, getCombinedIgnoreTester, getCombinedOrTester, getGDEF, getGlyph, getGlyph, getGlyphs, getGlyphs, getGlyphs, getGlyphsAvailable, getGlyphsAvailable, getGlyphsAvailable, getIgnoredAssociations, getIgnoredAssociations, getIgnoreDefault, getIgnoredGlyphs, getIgnoredGlyphs, getIgnoreTester, getInput, getLastPosition, getLookupFlags, getPosition, getUnprocessedGlyph, hasNext, hasNext, hasPrev, hasPrev, isBase, isIgnoredBase, isIgnoredGlyph, isIgnoredGlyph, isIgnoredGlyph, isIgnoredLigature, isIgnoredMark, isLigature, isMark, maybeApplicable, next, prev, replaceInput, replaceInput, reset, setGDEF, setGlyph, setIgnoreDefault, setLookupFlags, setPosition, updateSubtableState`

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

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

- - ### Constructor Detail

    - #### GlyphPositioningState

          public GlyphPositioningState()

      Construct default (reset) glyph positioning state.

    - #### GlyphPositioningState

          public GlyphPositioningState(GlyphSequence gs,
                                       String script,
                                       String language,
                                       String feature,
                                       int fontSize,
                                       int[] widths,
                                       int[][] adjustments,
                                       ScriptContextTester sct)

      Construct glyph positioning state.
      Parameters:
        `gs` - input glyph sequence
        `script` - script identifier
        `language` - language identifier
        `feature` - feature identifier
        `fontSize` - font size (in micropoints)
        `widths` - array of design advancements (in glyph index order)
        `adjustments` - positioning adjustments to which positioning is applied
        `sct` - script context tester (or null)

    - #### GlyphPositioningState

          public GlyphPositioningState(GlyphPositioningState ps)

      Construct glyph positioning state using an existing state object using shallow copy except as follows: input glyph sequence is copied deep except for its characters array.
      Parameters:
        `ps` - existing positioning state to copy from

  - ### Method Detail

    - #### reset

          public GlyphPositioningState reset(GlyphSequence gs,
                                             String script,
                                             String language,
                                             String feature,
                                             int fontSize,
                                             int[] widths,
                                             int[][] adjustments,
                                             ScriptContextTester sct)

      Reset glyph positioning state.
      Parameters:
        `gs` - input glyph sequence
        `script` - script identifier
        `language` - language identifier
        `feature` - feature identifier
        `fontSize` - font size (in micropoints)
        `widths` - array of design advancements (in glyph index order)
        `adjustments` - positioning adjustments to which positioning is applied
        `sct` - script context tester (or null)

    - #### getWidth

          public int getWidth(int gi)

      Obtain design advancement (width) of glyph at specified index.
      Parameters:
        `gi` - glyph index
      Returns:
        design advancement, or zero if glyph index is not present

    - #### adjust

          public boolean adjust(GlyphPositioningTable.Value v)

      Perform adjustments at current position index.
      Parameters:
        `v` - value containing adjustments
      Returns:
        true if a non-zero adjustment was made

    - #### adjust

          public boolean adjust(GlyphPositioningTable.Value v,
                                int offset)

      Perform adjustments at specified offset from current position index.
      Parameters:
        `v` - value containing adjustments
        `offset` - from current position index
      Returns:
        true if a non-zero adjustment was made

    - #### getAdjustment

          public int[] getAdjustment()

      Obtain current adjustments at current position index.
      Returns:
        array of adjustments (int[4]) at current position

    - #### getAdjustment

          public int[] getAdjustment(int offset)
                              throws IndexOutOfBoundsException

      Obtain current adjustments at specified offset from current position index.
      Parameters:
        `offset` - from current position index
      Returns:
        array of adjustments (int[4]) at specified offset
      Throws:
        `IndexOutOfBoundsException` - if offset is invalid

    - #### apply

          public boolean apply(GlyphPositioningSubtable st)

      Apply positioning subtable to current state at current position (only), resulting in the consumption of zero or more input glyphs.
      Parameters:
        `st` - the glyph positioning subtable to apply
      Returns:
        true if subtable applied, or false if it did not (e.g., its input coverage table did not match current input context)

    - #### apply

          public boolean apply(GlyphTable.RuleLookup[] lookups,
                               int nig)

      Apply a sequence of matched rule lookups to the `nig` input glyphs starting at the current position. If lookups are non-null and non-empty, then all input glyphs specified by `nig` are consumed irregardless of whether any specified lookup applied.
      Parameters:
        `lookups` - array of matched lookups (or null)
        `nig` - number of glyphs in input sequence, starting at current position, to which the lookups are to apply, and to be consumed once the application has finished
      Returns:
        true if lookups are non-null and non-empty; otherwise, false

    - #### applyDefault

          public void applyDefault()

      Apply default application semantices; namely, consume one input glyph.
      Overrides:
        `applyDefault` in class `GlyphProcessingState`

    - #### setAdjusted

          public void setAdjusted(boolean adjusted)

      Set adjusted state, used to record effect of non-zero adjustment.
      Parameters:
        `adjusted` - true if to set adjusted state, otherwise false to clear adjusted state

    - #### getAdjusted

          public boolean getAdjusted()

      Get adjusted state.
      Returns:
        adjusted true if some non-zero adjustment occurred and was recorded by `setAdjusted(boolean)`; otherwise, false.

Copyright © 2025 Apache Software Foundation. All rights reserved.