Docsv2.12.12
Back to API Reference
Class

Style

sealed

Serializable container that links a modifier with its parse rule. Tracks registration state and ownership to prevent bugs.

Remarks

Note: "Initialized" state (buffers created, events subscribed) is tracked by BaseModifier.IsInitialized and happens lazily on first Apply(). Ownership rules: - Style tracks its owner UniText - Registration fails if already registered to different owner - State resets on deserialization
public BaseModifier Modifier{ get; set }

Gets or sets the modifier, with proper lifecycle management on hot-swap.

public IParseRule Rule{ get; set }

Gets or sets the parse rule, with proper lifecycle management on hot-swap.

public string DefaultParameter{ get; set }

Parameter forwarded to Modifier when this style has no Rule (whole-text application). Ignored when Rule is set — the rule then supplies its own parameter(s) per matched range. The setter auto-dirties the owning component when the style is registered and rule-less.

public UniTextBase Owner{ get }

Gets the UniTextBase that owns this Style.

public bool IsValid{ get }

Returns true if the style is ready for registration. A modifier with no rule is treated as a whole-text application (no constraint = no limit); a rule with no modifier is valid only when the rule is IsStandalone (protection rules).

public bool IsRegistered{ get }

Returns true if registered to a UniText.

public static Style WholeText(BaseModifier modifier, string parameter)

Builds a style that applies modifier to the entire text. No Rule is created — the absence of a rule is interpreted as "no constraint, apply everywhere", and parameter is forwarded to the modifier on every cycle via defaultParameter.

public static Style Range(BaseModifier modifier, int start, int end, string parameter)

Builds a style that applies modifier to a fixed codepoint range via a RangeRule.

public static Style Tag(BaseModifier modifier, string tagName, string defaultParameter)

Builds a style that activates modifier on ranges matched by a rich-text tag <tagName>...</tagName>.

See Also

BaseModifierIParseRuleAttributeParser