pretext
Native Unicode paragraph preparation and layout for the Pretext Rust workspace.
pretext owns font discovery, shaping, bidi resolution, whitespace handling, line breaking,
paragraph measurement, and reusable layout caches. It is renderer-agnostic: use it directly for
measurement or pair it with pretext-egui for painting in egui.
Install
[]
= "0.1.0"
Basic paragraph layout
use ;
let engine = builder.build;
let style = PretextStyle ;
let options = PretextParagraphOptions ;
let prepared = engine.prepare_paragraph;
let metrics = prepared.measure;
let layout = prepared.layout;
let geometry = prepared.measure_line_geometry;
let natural_width = prepared.measure_natural_width;
assert!;
assert_eq!;
assert_eq!;
assert!;
Font setup
By default, PretextEngine::builder().build() includes system fonts. For deterministic output,
provide font bytes and disable system font fallback:
use PretextEngine;
let font_data = vec!;
let engine = builder
.with_font_data
.include_system_fonts
.build;
# Ok::
Lower-level APIs
- Use root exports such as
PretextEngine,PretextStyle, andPretextParagraphOptionsfor the stable path. - Use
pretext::rich_inlinefor inline-only mixed-style flow with atomic placeholders. - Use
pretext::advancedfor cursor-driven line continuation, glyph runs, and custom renderers.