Class GlyphPositioningTable


  • public class GlyphPositioningTable
    extends GlyphTable

    The GlyphPositioningTable class is a glyph table that implements GlyphPositioning functionality.

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

    • Field Detail

      • GPOS_LOOKUP_TYPE_SINGLE

        public static final int GPOS_LOOKUP_TYPE_SINGLE
        single positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_PAIR

        public static final int GPOS_LOOKUP_TYPE_PAIR
        multiple positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_CURSIVE

        public static final int GPOS_LOOKUP_TYPE_CURSIVE
        cursive positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_MARK_TO_BASE

        public static final int GPOS_LOOKUP_TYPE_MARK_TO_BASE
        mark to base positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE

        public static final int GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE
        mark to ligature positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_MARK_TO_MARK

        public static final int GPOS_LOOKUP_TYPE_MARK_TO_MARK
        mark to mark positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_CONTEXTUAL

        public static final int GPOS_LOOKUP_TYPE_CONTEXTUAL
        contextual positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL

        public static final int GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL
        chained contextual positioning subtable type
        See Also:
        Constant Field Values
      • GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING

        public static final int GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING
        extension positioning subtable type
        See Also:
        Constant Field Values
    • Constructor Detail

      • GlyphPositioningTable

        public GlyphPositioningTable​(GlyphDefinitionTable gdef,
                                     java.util.Map lookups,
                                     java.util.List subtables,
                                     java.util.Map<java.lang.String,​ScriptProcessor> processors)
        Instantiate a GlyphPositioningTable object using the specified lookups and subtables.
        Parameters:
        gdef - glyph definition table that applies
        lookups - a map of lookup specifications to subtable identifier strings
        subtables - a list of identified subtables
    • Method Detail

      • getLookupTypeFromName

        public static int getLookupTypeFromName​(java.lang.String name)
        Map a lookup type name to its constant (integer) value.
        Parameters:
        name - lookup type name
        Returns:
        lookup type
      • getLookupTypeName

        public static java.lang.String getLookupTypeName​(int type)
        Map a lookup type constant (integer) value to its name.
        Parameters:
        type - lookup type
        Returns:
        lookup type name
      • createSubtable

        public static GlyphSubtable createSubtable​(int type,
                                                   java.lang.String id,
                                                   int sequence,
                                                   int flags,
                                                   int format,
                                                   GlyphCoverageTable coverage,
                                                   java.util.List entries)
        Create a positioning subtable according to the specified arguments.
        Parameters:
        type - subtable type
        id - subtable identifier
        sequence - subtable sequence
        flags - subtable flags
        format - subtable format
        coverage - subtable coverage table
        entries - subtable entries
        Returns:
        a glyph subtable instance
      • createSubtable

        public static GlyphSubtable createSubtable​(int type,
                                                   java.lang.String id,
                                                   int sequence,
                                                   int flags,
                                                   int format,
                                                   java.util.List coverage,
                                                   java.util.List entries)
        Create a positioning subtable according to the specified arguments.
        Parameters:
        type - subtable type
        id - subtable identifier
        sequence - subtable sequence
        flags - subtable flags
        format - subtable format
        coverage - list of coverage table entries
        entries - subtable entries
        Returns:
        a glyph subtable instance
      • position

        public boolean position​(GlyphSequence gs,
                                java.lang.String script,
                                java.lang.String language,
                                int fontSize,
                                int[] widths,
                                int[][] adjustments)
        Perform positioning processing using all matching lookups.
        Parameters:
        gs - an input glyph sequence
        script - a script identifier
        language - a language identifier
        fontSize - size in device units
        widths - array of default advancements for each glyph
        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
        Returns:
        true if some adjustment is not zero; otherwise, false