Expand description
Shaped-run render path with spacing/kerning deltas.
This module transforms a ShapedRun into a sequence of cell-ready
placements that a renderer can consume to produce output with correct
spacing, kerning, and ligature handling.
§Design
The render path operates in sub-cell units (1/256 cell column) for precision, then quantizes to integer cell positions for the terminal grid. This preserves the kerning and spacing fidelity from the shaping engine while producing deterministic cell-grid output.
§Pipeline
ShapedRun + text
→ ClusterMap (byte↔cell mapping)
→ ShapedLineLayout (cell placements with sub-cell spacing)
→ apply justification/tracking deltas
→ quantized cell positions for buffer rendering§Example
use ftui_text::shaped_render::{ShapedLineLayout, RenderHint};
use ftui_text::shaping::{NoopShaper, TextShaper, FontFeatures};
use ftui_text::script_segmentation::{Script, RunDirection};
let text = "Hello!";
let shaper = NoopShaper;
let features = FontFeatures::default();
let run = shaper.shape(text, Script::Latin, RunDirection::Ltr, &features);
let layout = ShapedLineLayout::from_run(text, &run);
assert_eq!(layout.total_cells(), 6);
assert_eq!(layout.placements().len(), 6);
assert_eq!(layout.placements()[0].render_hint, RenderHint::DirectChar('H'));Structs§
- Cell
Placement - A single cell placement in the shaped output line.
- Shaped
Line Layout - A line of shaped text ready for rendering.
- Spacing
Delta - A sub-cell spacing adjustment applied between or within clusters.
Enums§
- Render
Hint - Hint for how to render a cell’s content.