Skip to main content

Crate frust_text

Crate frust_text 

Source
Expand description

Parley 0.11 text pipeline for Frust.

Wraps parley’s font matching and layout into a small, renderer-agnostic surface: TextContext owns the heavyweight font/layout state, TextStyle carries the styling knobs (family/weight/style/size/color/ letter-spacing/line-height — the M3 type-scale surface), and TextLayout is a finished, measurable block of text that converts into frust_scene::GlyphRuns. Only kurbo/peniko/frust-scene types appear in the public API — no vello, wgpu, or parley types leak through. The parley -> vello glyph coordinate contract lives in [convert].

Structs§

EditingState
The editing value in UTF-16 code-unit offsets — the Flutter-canonical shape the Android/iOS bridges exchange (-1 denotes “none”).
EditingStateBytes
The editing value in byte offsets — the parley-native representation and the shape EditOp::ApplyEditingState consumes.
FontWeight
Visual weight of a font, on the standard 1-1000 CSS font-weight scale.
RegisteredFamily
A font family registered via TextContext::register_fonts, reported back to the caller so it can resolve widget styles against the exact name(s) fontique assigned.
ShapeCacheStats
Instrumentation counters for the shape cache — the observable hook the shape-cache tests assert against, and a perf signal otherwise.
TextContext
Owns parley’s font matching and layout scratch state.
TextEditor
The editing engine wrapping a parley PlainEditor.
TextLayout
A finished text layout: positioned glyph runs plus a cached measured size.
TextStyle
Styling applied uniformly to a laid-out string.

Enums§

EditOp
A single editing command applied to a TextEditor.
FamilyName
One element of a fallback stack: a concrete family name or a generic class.
FontError
Errors from TextContext::register_fonts.
FontFamily
Font family selection.
FontStyle
Visual slant of a font.
GenericSlot
Generic font families supported as fallback slots.
LineHeight
Line height: how much vertical space each line of text occupies.
TextAlign
Paragraph alignment: how each line is positioned within the layout’s width.
TextOverflow
How text that overflows a bounded [TextContext::layout_bounded] (max_lines) is handled.

Functions§

byte_to_utf16
Converts a byte offset into text to a UTF-16 code-unit offset.
register_generic_fallback
Registers data (raw font bytes) as a fallback face for each generic family slot in generics, applied to every TextContext — existing, on its next TextContext::sync_app_fonts, and future, seeded for free by TextContext::new — via fontique::Collection::append_generic_families.
sanitize_paste
Normalizes pasted text for insertion, handling line-ending differences.
utf16_to_byte
Converts a UTF-16 code-unit offset into text to a byte offset.