Class GlyphSubstitutionSubtable

java.lang.Object
org.apache.fop.complexscripts.fonts.GlyphSubtable
org.apache.fop.complexscripts.fonts.GlyphSubstitutionSubtable
All Implemented Interfaces:
Comparable, GlyphSubstitution

public abstract class GlyphSubstitutionSubtable extends GlyphSubtable implements GlyphSubstitution

The GlyphSubstitutionSubtable implements an abstract base of a glyph substitution subtable, providing a default implementation of the GlyphSubstitution interface.

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

  • Constructor Details

    • GlyphSubstitutionSubtable

      protected GlyphSubstitutionSubtable(String id, int sequence, int flags, int format, GlyphCoverageTable coverage)
      Instantiate a GlyphSubstitutionSubtable.
      Parameters:
      id - subtable identifier
      sequence - subtable sequence
      flags - subtable flags
      format - subtable format
      coverage - subtable coverage table
  • Method Details

    • getTableType

      public int getTableType()
      Specified by:
      getTableType in class GlyphSubtable
      Returns:
      this subtable's table type
    • getTypeName

      public String getTypeName()
      Specified by:
      getTypeName in class GlyphSubtable
      Returns:
      this subtable's type name
    • isCompatible

      public boolean isCompatible(GlyphSubtable subtable)
      Determine if a glyph subtable is compatible with this glyph subtable. Two glyph subtables are compatible if the both may appear in a single lookup table.
      Specified by:
      isCompatible in class GlyphSubtable
      Parameters:
      subtable - a glyph subtable to determine compatibility
      Returns:
      true if specified subtable is compatible with this glyph subtable, where by compatible is meant that they share the same lookup type
    • usesReverseScan

      public boolean usesReverseScan()
      Specified by:
      usesReverseScan in class GlyphSubtable
      Returns:
      true if subtable uses reverse scanning of glyph sequence, meaning from the last glyph in a glyph sequence to the first glyph
    • substitute

      public boolean substitute(GlyphSubstitutionState ss)
      Perform glyph substitution at the current index, mutating the substitution state object as required. Only the context associated with the current index is processed.
      Specified by:
      substitute in interface GlyphSubstitution
      Parameters:
      ss - glyph substitution state object
      Returns:
      true if the glyph subtable was applied, meaning that the current context matches the associated input context glyph coverage table
    • substitute

      public static final GlyphSequence substitute(GlyphSubstitutionState ss, GlyphSubstitutionSubtable[] sta, int sequenceIndex)
      Apply substitutions using specified state and subtable array. For each position in input sequence, apply subtables in order until some subtable applies or none remain. If no subtable applied or no input was consumed for a given position, then apply default action (copy input glyph and advance). If sequenceIndex is non-negative, then apply subtables only when current position matches sequenceIndex in relation to the starting position. Furthermore, upon successful application at sequenceIndex, then apply default action for all remaining glyphs in input sequence.
      Parameters:
      ss - substitution state
      sta - array of subtables to apply
      sequenceIndex - if non negative, then apply subtables only at specified sequence index
      Returns:
      output glyph sequence
    • substitute

      public static final GlyphSequence substitute(GlyphSequence gs, String script, String language, String feature, GlyphSubstitutionSubtable[] sta, ScriptContextTester sct)
      Apply substitutions.
      Parameters:
      gs - input glyph sequence
      script - tag
      language - tag
      feature - tag
      sta - subtable array
      sct - script context tester
      Returns:
      output glyph sequence