Back to API Reference
Struct

TextHitResult

sealed

Result of a range-style text hit test (bounding-box semantics) — identifies the glyph whose rect contains the point. Returned by HitTestRange and its screen-coordinate overload. Use this when asking "which entity is at this position" (links, hashtags, hover-style ranges). For "where should the caret go" queries call HitTestCaret instead — caret semantics need edge-snap (left half of glyph N → cluster N, right half → cluster N+1) which this type does not represent.

[ctor]public TextHitResult()
public readonly bool hit

True if a glyph was hit.

public readonly int glyphIndex

Index of the hit glyph in the positioned glyphs array.

public readonly int cluster

Cluster index (codepoint offset in source text).

public readonly Vector2 glyphPosition

Position of the hit glyph.

public readonly float distance

Distance from the hit point to the glyph center.

public static readonly TextHitResult None

Represents no hit.