Class GlyphTable.LookupTable

  • All Implemented Interfaces:
    java.lang.Comparable
    Enclosing class:
    GlyphTable

    public static class GlyphTable.LookupTable
    extends java.lang.Object
    implements java.lang.Comparable
    The LookupTable class comprising an identifier and an ordered list of glyph subtables, each of which employ the same lookup identifier.
    • Field Detail

      • id

        private final java.lang.String id
      • idOrdinal

        private final int idOrdinal
      • subtables

        private final java.util.List<GlyphSubtable> subtables
      • doesSub

        private boolean doesSub
      • doesPos

        private boolean doesPos
      • frozen

        private boolean frozen
      • subtablesArrayEmpty

        private static GlyphSubtable[] subtablesArrayEmpty
    • Constructor Detail

      • LookupTable

        public LookupTable​(java.lang.String id,
                           GlyphSubtable subtable)
        Instantiate a LookupTable.
        Parameters:
        id - the lookup table's identifier
        subtable - an initial subtable (or null)
      • LookupTable

        public LookupTable​(java.lang.String id,
                           java.util.List<GlyphSubtable> subtables)
        Instantiate a LookupTable.
        Parameters:
        id - the lookup table's identifier
        subtables - a pre-poplated list of subtables or null
    • Method Detail

      • getSubtables

        public GlyphSubtable[] getSubtables()
        Returns:
        the subtables as an array
      • addSubtable

        public boolean addSubtable​(GlyphSubtable subtable)
        Add a subtable into this lookup table's collecion of subtables according to its natural order.
        Parameters:
        subtable - to add
        Returns:
        true if subtable was not already present, otherwise false
      • validateSubtable

        private void validateSubtable​(GlyphSubtable subtable)
      • freezeSubtables

        public void freezeSubtables​(java.util.Map<java.lang.String,​GlyphTable.LookupTable> lookupTables)
        Freeze subtables, i.e., do not allow further subtable addition, and create resulting cached state. In addition, resolve any references to lookup tables that appear in this lookup table's subtables.
        Parameters:
        lookupTables - map from lookup table identifers, e.g. "lu4", to lookup tables
      • performsSubstitution

        public boolean performsSubstitution()
        Determine if this glyph table performs substitution.
        Returns:
        true if it performs substitution
      • substitute

        public GlyphSequence substitute​(GlyphSequence gs,
                                        java.lang.String script,
                                        java.lang.String language,
                                        java.lang.String feature,
                                        ScriptContextTester sct)
        Perform substitution processing using this lookup table's subtables.
        Parameters:
        gs - an input glyph sequence
        script - a script identifier
        language - a language identifier
        feature - a feature identifier
        sct - a script specific context tester (or null)
        Returns:
        the substituted (output) glyph sequence
      • substitute

        public GlyphSequence substitute​(GlyphSubstitutionState ss,
                                        int sequenceIndex)
        Perform substitution processing on an existing glyph substitution state object using this lookup table's subtables.
        Parameters:
        ss - a glyph substitution state object
        sequenceIndex - if non negative, then apply subtables only at specified sequence index
        Returns:
        the substituted (output) glyph sequence
      • performsPositioning

        public boolean performsPositioning()
        Determine if this glyph table performs positioning.
        Returns:
        true if it performs positioning
      • position

        public boolean position​(GlyphSequence gs,
                                java.lang.String script,
                                java.lang.String language,
                                java.lang.String feature,
                                int fontSize,
                                int[] widths,
                                int[][] adjustments,
                                ScriptContextTester sct)
        Perform positioning processing using this lookup table's subtables.
        Parameters:
        gs - an input glyph sequence
        script - a script identifier
        language - a language identifier
        feature - a feature identifier
        fontSize - size in device units
        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
      • position

        public boolean position​(GlyphPositioningState ps,
                                int sequenceIndex)
        Perform positioning processing on an existing glyph positioning state object using this lookup table's subtables.
        Parameters:
        ps - a glyph positioning state object
        sequenceIndex - if non negative, then apply subtables only at specified sequence index
        Returns:
        true if some adjustment is not zero; otherwise, false
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if identifier of the specified lookup table is the same as the identifier of this lookup table
      • compareTo

        public int compareTo​(java.lang.Object o)
        Specified by:
        compareTo in interface java.lang.Comparable
        Returns:
        the result of comparing the identifier of the specified lookup table with the identifier of this lookup table; lookup table identifiers take the form "lu(DIGIT)+", with comparison based on numerical ordering of numbers expressed by (DIGIT)+.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object