harfbuzzjs
    Preparing search index...

    Class Feature

    A HarfBuzz feature.

    The structure that holds information about requested feature application. The feature will be applied with the given value to all glyphs which are in clusters between Feature.start (inclusive) and Feature.end (exclusive). Setting start to 0 and end to 0xffffffff specifies that the feature always applies to the entire buffer.

    Index

    Constructors

    • Parameters

      • tag: string
      • value: number = 1
      • start: number = Feature.GLOBAL_START
      • end: number = Feature.GLOBAL_END

      Returns Feature

    Properties

    end: number

    The cluster to end applying this feature setting (exclusive).

    start: number

    The cluster to start applying this feature setting (inclusive).

    tag: string

    The tag of the feature.

    value: number

    The value of the feature. 0 disables the feature, non-zero (usually 1) enables the feature. For features implemented as lookup type 3 (like salt) the value is a one-based index into the alternates.

    GLOBAL_END: 4294967295 = 0xffffffff

    Special setting for Feature.end to apply the feature from to the end of the buffer.

    GLOBAL_START: 0

    Special setting for Feature.start to apply the feature from the start of the buffer.

    Methods

    • Converts the feature to a string in the format understood by Feature.fromString.

      Note that the feature value will be omitted if it is 1, but the string won't include any whitespace.

      Returns string

      The feature string.

    • Internal

      Write this feature into the given hb_feature_t pointer.

      Parameters

      • ptr: number

      Returns void

    • Parses a string into a Feature.

      The format for specifying feature strings follows. All valid CSS font-feature-settings values other than normal and the global values are also accepted, though not documented below. CSS string escapes are not supported.

      The range indices refer to the positions between Unicode characters. The position before the first character is always 0.

      The format is Python-esque. Here is how it all works:

      Syntax Value Start End Meaning
      kern 1 0 Turn feature on
      +kern 1 0 Turn feature on
      -kern 0 0 Turn feature off
      kern=0 0 0 Turn feature off
      kern=1 1 0 Turn feature on
      aalt=2 2 0 Choose 2nd alternate
      kern[] 1 0 Turn feature on
      kern[:] 1 0 Turn feature on
      kern[5:] 1 5 Turn feature on, partial
      kern[:5] 1 0 5 Turn feature on, partial
      kern[3:5] 1 3 5 Turn feature on, range
      kern[3] 1 3 3+1 Turn feature on, single char
      aalt[3:5]=2 2 3 5 Turn 2nd alternate on for range

      Parameters

      • str: string

        The string to parse.

      Returns Feature | undefined

      A Feature, or undefined if the string is not a valid feature.