Skip to main content

Module caption

Module caption 

Source
Expand description

Caption block — wrapped text on top of a rounded rect background (M-TEXT.9 / AUT-83).

Composition only; no new shaders. Layout works in NDC throughout:

  1. Construct a CaptionBlock with text, style, max_width_ndc, and padding_ndc.
  2. Call CaptionBlock::layout with the crate::text::TextTexturePipeline to measure the text and produce a list of scene nodes:
    • a background Graphics rounded rect sized to the wrapped text + padding;
    • a Sprite carrying the rendered text texture, positioned inside the padding rect.
  3. Caller attaches both nodes to a Container (or directly to the stage); the container’s transform handles position.

Honors WispTextStyle::align (the text texture itself respects the style’s alignment) and line_height (cosmic-text handles wrap + line metrics).

Structs§

CaptionBlock
Builder for a wrapped caption block with a rounded-rect background.
CaptionLayout
Result of laying out a CaptionBlock.