pub fn prepare_styled_layout(
engine: &mut ParleyEngine,
params: StyledTextLayoutParams<'_>,
face_blobs: &mut HashMap<u64, Arc<[u8]>>,
) -> PreparedTextLayoutExpand description
Builds a colored, ranged-style layout and registers its font blobs.
Each output glyph carries the effective run color. Span ranges must be
ordered, in bounds, and on UTF-8 boundaries; they replace font family, size,
and color, while text decoration remains paint-only. face_blobs has the
same append-only, no-eviction behavior as in prepare_layout.
§Panics
Parley may panic if a span has an invalid UTF-8 byte range.
§Examples
use std::collections::HashMap;
use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_text::{ParleyEngine, StyledTextLayoutParams, StyledTextSpan, WrapMode};
use ailloli_ui_text::prepared::prepare_styled_layout;
#[allow(deprecated)] let mut engine = ParleyEngine::new();
let base = TextStyle::new(FontId::Mono, 14, Color::WHITE);
let spans = [StyledTextSpan { range: 0..2, style: TextStyle::new(FontId::Mono, 14, Color::BLACK) }];
let mut faces = HashMap::new();
let prepared = prepare_styled_layout(&mut engine, StyledTextLayoutParams {
text: "fn main", base_style: base, spans: &spans,
max_width: None, wrap_mode: WrapMode::NoWrap,
}, &mut faces);
assert!(prepared.glyphs().iter().all(|glyph| glyph.color.is_some()));