Vixen
dd8b0a81
csharp
public readonly record struct FontFeature

One OpenType feature, switched on or off for a whole run.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

CSS Fonts 4 gives two ways to ask for one and they arrive here as the same thing. font-feature-settings: "tnum" 1 names the tag directly; font-variant-numeric: tabular-nums names a typographic intention that is that tag. So the high-level property is a table of these and the low-level one is a parser for them, and the shaper below never learns which of the two a feature came from.

⚠ No range. CSS and OpenType both allow a feature to be switched on over part of a run — "liga" 1 [3:7] in HarfBuzz's own syntax — and CSS's grammar does not expose it, so neither does this. A feature here applies to the whole shaped paragraph, which is what every declaration a stylesheet can write means.

Fields and properties (2)

  • public uint Tag

    The four-character OpenType tag, packed big-endian as HarfBuzz packs it.

  • public uint Value

    What to set it to. Zero is off, one is on, and a larger number selects an alternate for the features that number theirs.

Methods (5)

  • public FontFeature(uint Tag, uint Value)

    One OpenType feature, switched on or off for a whole run.

  • public static uint Pack(ReadOnlySpan<char> tag)

    Packs a four-character tag.

  • public static string Unpack(uint tag)

    Unpacks a tag back into its four characters.

  • public static bool TryParse(ReadOnlySpan<char> text, out FontFeature feature)

    Reads one <feature-tag-value>, as CSS Fonts 4 § 6.4 spells it.

  • public override string ToString()

    Returns the fully qualified type name of this instance.

Used by (7)

  • FontFeatureSetVixen.Ui.Text
  • FontFeatureStyleTestsVixen.Ui.Tests
  • FontFeatureTestsVixen.Ui.Text.Tests
  • NumericFigureVisibilityTestsVixen.Ui.Styling.Utilities.Tests
  • TextShaperVixen.Ui.Text
  • UiDocumentVixen.Ui
  • UtilityFamilySupportTestsVixen.Editor.Ui.Tests