weasel API - v0.8.0
    Preparing search index...

    Function measureTextBounds

    • Measure how the GL/MSDF renderer will lay out a single plain-text string, using the registered font atlas metrics. Mirrors textCommand exactly (resolveTextStyleresolveRunslayoutRuns), so the returned bounds match what actually gets drawn — use it to size backgrounds/pills, place labels, or test overlap without guessing widths.

      Pass opts.maxWidth to measure word-wrapped height (e.g. for a fixed-width text box); omitting it measures the unwrapped single-line width. opts.lineHeight overrides the style's multiplier without changing style itself.

      Returns { width, height } in the same units as style.fontSize. The font must already be registered via registerFont; an unregistered family falls back to the atlas fallback glyph (and warns), so register fonts at app boot before measuring.

      Parameters

      Returns { height: number; width: number }