Expand description
Flexible text backend — Cosmic Text layout (M-TEXT.2 / AUT-76).
FlexibleText is the styled / wrapped / shaped text path. It uses
cosmic_text for layout (line breaking, BiDi, font fallback,
shaping) and — once M-TEXT.3 lands — glyphon for rasterization.
This chunk is the layout half. The renderer half (glyphon
pipeline + WispTextRenderer impl) lands in M-TEXT.3 / AUT-77.
Until then, the engine produces FlexibleTextLayout instances that
carry an internal cosmic_text::Buffer ready to be fed to glyphon.
§Boundary
The trait surface (WispTextEngine, WispTextLayout) does
not expose cosmic_text::* types — they live behind private
fields on FlexibleTextLayout. App / editor / project code only
sees WispText + Box<dyn WispTextLayout>. The renderer
(glyphon) downcasts to read the buffer.
§Layout reference basis
Cosmic Text works in pixels; wisp works in NDC. The engine adopts
a reference height of REFERENCE_PX pixels — style.size_ndc
is multiplied by this constant to derive the cosmic-text font
size. Per-glyph positions are converted back to NDC by dividing by
the same constant. The renderer (M-TEXT.3) re-scales to the actual
target dimensions at draw time.
Picking 1000 px as the basis keeps numbers well within f32
precision, gives sub-pixel positioning headroom for size_ndc = 0.06 (= 60 px ≈ caption-y), and matches what glyphon’s atlas
cache expects for typical desktop UIs.
Structs§
- Flexible
Text Engine - Cosmic-Text-backed layout engine.
- Flexible
Text Layout - Result of
FlexibleTextEngine::layout— a shaped cosmic-textBufferplus metrics.
Constants§
- REFERENCE_
PX - Pixel basis for NDC ↔ cosmic-text px conversion. See module docs.