Skip to main content

Module text

Module text 

Source
Expand description

Wisp text abstraction + backend boundary (M-TEXT.1 / AUT-75).

Backend modules live under this one — see atlas for the bitmap-font path (M-TEXT.4 / AUT-78). M-TEXT.2/.3 will add a flexible module wrapping cosmic_text + glyphon.

Wisp owns the text data model. App, editor, and project state never see cosmic_text::* or glyphon::* types — they see WispText, WispTextStyle, WispTextLayout, and a few related value types. Backends (WispTextEngine + WispTextRenderer) plug in behind this surface; today the only backend is the M0.15 bitmap path (preserved as AtlasText in M-TEXT.4 / AUT-78). M-TEXT.2/.3 add a Cosmic Text + Glyphon FlexibleText backend.

The boundary is what makes “improve text rendering” possible without a project-format breaking change.

§Type relationships

  WispText { content, style, position }
        │
        │ engine.layout(text)
        ▼
  Box<dyn WispTextLayout>           ── line-broken, per-glyph data
        │ metrics()                       (engine-specific concrete type)
        │
        ▼
  renderer.draw(layout, transform)   ── GPU side

For most users WispText is the only type they construct directly. Backends are selected through whichever method on crate::render::Renderer consumes the text (e.g. apply_atlas_text today; apply_flexible_text after M-TEXT.3).

Re-exports§

pub use atlas::AtlasGlyphInstance;
pub use atlas::AtlasTextEngine;
pub use atlas::AtlasTextLayout;
pub use caption::CaptionBlock;
pub use caption::CaptionLayout;
pub use flexible::FlexibleTextEngine;
pub use flexible::FlexibleTextLayout;
pub use flexible_renderer::FlexibleTextRenderer;
pub use presets::TextPreset;
pub use stroke::StrokedTextLayer;
pub use stroke::stroked_text_sprites;
pub use texture::TextTextureCache;
pub use texture::TextTextureKey;
pub use texture::TextTexturePipeline;

Modules§

atlas
Atlas text backend (M-TEXT.4 / AUT-78).
caption
Caption block — wrapped text on top of a rounded rect background (M-TEXT.9 / AUT-83).
flexible
Flexible text backend — Cosmic Text layout (M-TEXT.2 / AUT-76).
flexible_renderer
Flexible text renderer — glyphon rasterization (M-TEXT.3 / AUT-77).
presets
Curated WispTextStyle presets for common screen-recording captions (M-TEXT.12 / AUT-86).
stroke
Stroked / outlined text rendering (M-TEXT.7 / AUT-81).
texture
Text render-to-texture path (M-TEXT.5 / AUT-79).

Structs§

WispFontHandle
Font reference. Opaque identifier — the backend knows how to resolve it. Atlas backend treats it as a slot id; Cosmic Text backend treats it as a Family + Weight + Style query.
WispText
User-facing text primitive. Owns content + style + position; the engine + renderer turn it into pixels.
WispTextMetrics
Layout-time metrics for a piece of text — output of WispTextEngine::layout.
WispTextStyle
Style applied to a WispText. Pure data — no third-party types.

Enums§

WispFontStyle
Italic / oblique state.
WispFontWeight
Font weight on a 100..=900 scale matching CSS / OpenType.
WispTextAlign
Horizontal alignment of laid-out lines within their box.

Traits§

WispTextEngine
Text-layout engine — turns a WispText into a backend-specific WispTextLayout implementor.
WispTextLayout
A laid-out piece of text — ready to be rendered.
WispTextRenderer
Text renderer — consumes a layout and emits GPU draw calls.