Class GlyphTable

java.lang.Object
org.apache.fop.complexscripts.fonts.GlyphTable
Direct Known Subclasses:
GlyphDefinitionTable, GlyphPositioningTable, GlyphSubstitutionTable

public class GlyphTable extends Object

Base class for all advanced typographic glyph tables.

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

  • Field Details

    • GLYPH_TABLE_TYPE_SUBSTITUTION

      public static final int GLYPH_TABLE_TYPE_SUBSTITUTION
      substitution glyph table type
      See Also:
    • GLYPH_TABLE_TYPE_POSITIONING

      public static final int GLYPH_TABLE_TYPE_POSITIONING
      positioning glyph table type
      See Also:
    • GLYPH_TABLE_TYPE_JUSTIFICATION

      public static final int GLYPH_TABLE_TYPE_JUSTIFICATION
      justification glyph table type
      See Also:
    • GLYPH_TABLE_TYPE_BASELINE

      public static final int GLYPH_TABLE_TYPE_BASELINE
      baseline glyph table type
      See Also:
    • GLYPH_TABLE_TYPE_DEFINITION

      public static final int GLYPH_TABLE_TYPE_DEFINITION
      definition glyph table type
      See Also:
    • processors

      protected Map<String,ScriptProcessor> processors
  • Constructor Details

  • Method Details

    • getGlyphDefinitions

      public GlyphDefinitionTable getGlyphDefinitions()
      Obtain glyph definition table.
      Returns:
      (possibly null) glyph definition table
    • getLookups

      public List<GlyphTable.LookupSpec> getLookups()
      Obtain list of all lookup specifications.
      Returns:
      (possibly empty) list of all lookup specifications
    • getLookupTables

      public List<GlyphTable.LookupTable> getLookupTables()
      Obtain ordered list of all lookup tables, where order is by lookup identifier, which lexicographic ordering follows the lookup list order.
      Returns:
      (possibly empty) ordered list of all lookup tables
    • getLookupTable

      public GlyphTable.LookupTable getLookupTable(String lid)
      Obtain lookup table by lookup id. This method is used by test code, and provides access to embedded lookups not normally accessed by {script, language, feature} lookup spec.
      Parameters:
      lid - lookup id
      Returns:
      table associated with lookup id or null if none
    • addSubtable

      protected void addSubtable(GlyphSubtable subtable)
      Add a subtable.
      Parameters:
      subtable - a (non-null) glyph subtable
    • freezeSubtables

      protected void freezeSubtables()
      Freeze subtables, i.e., do not allow further subtable addition, and create resulting cached state.
    • matchLookupSpecs

      public List<GlyphTable.LookupSpec> matchLookupSpecs(String script, String language, String feature)
      Match lookup specifications according to <script,language,feature> tuple, where '*' is a wildcard for a tuple component.
      Parameters:
      script - a script identifier
      language - a language identifier
      feature - a feature identifier
      Returns:
      a (possibly empty) array of matching lookup specifications
    • matchLookups

      public Map<GlyphTable.LookupSpec,List<GlyphTable.LookupTable>> matchLookups(String script, String language, String feature)
      Match lookup specifications according to <script,language,feature> tuple, where '*' is a wildcard for a tuple component.
      Parameters:
      script - a script identifier
      language - a language identifier
      feature - a feature identifier
      Returns:
      a (possibly empty) map from matching lookup specifications to lists of corresponding lookup tables
    • findLookupTables

      public List<GlyphTable.LookupTable> findLookupTables(GlyphTable.LookupSpec ls)
      Obtain ordered list of glyph lookup tables that match a specific lookup specification.
      Parameters:
      ls - a (non-null) lookup specification
      Returns:
      a (possibly empty) ordered list of lookup tables whose corresponding lookup specifications match the specified lookup spec
    • assembleLookups

      public GlyphTable.UseSpec[] assembleLookups(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:
      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
    • hasFeature

      public boolean hasFeature(String script, String language, String feature)
      Determine if table supports specific feature, i.e., supports at least one lookup.
      Parameters:
      script - to qualify feature lookup
      language - to qualify feature lookup
      feature - to test
      Returns:
      true if feature supported (has at least one lookup)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTableTypeFromName

      public static int getTableTypeFromName(String name)
      Obtain glyph table type from name.
      Parameters:
      name - of table type to map to type value
      Returns:
      glyph table type (as an integer constant)
    • resolveLookupReferences

      public static void resolveLookupReferences(GlyphTable.RuleSet[] rsa, Map<String,GlyphTable.LookupTable> lookupTables)
      Resolve references to lookup tables in a collection of rules sets.
      Parameters:
      rsa - array of rule sets
      lookupTables - map from lookup table identifers, e.g. "lu4", to lookup tables