Paint inline NFSS runs with their own faces

This commit is contained in:
gloamxun committed 2026-10-24 02:09:56 +08:00
1 parent 67898d6a8a
commit 53fabe95db
6 files changed
+223 -17

No files matched your search

+20
View File
@@ -1244,6 +1244,26 @@ impl Unit {
Self::paragraph_with_style_and_face(id, source, style, ParagraphFont::Roman)
}
/// Build a paragraph unit whose text is split into styled runs.
pub fn paragraph_with_style_and_runs(
id: UnitId,
source: impl Into<String>,
style: ParagraphStyle,
runs: Vec<(ParagraphFont, String)>,
) -> Self {
let source = source.into();
let paragraph = crate::paragraph::layout_paragraph_runs(&runs, &style);
Self {
id,
source,
items: vec![VerticalItem::Paragraph(paragraph)],
paragraph_style: Some(style),
space_before: 0,
space_stretch: 0,
space_shrink: 0,
}
}
/// Build a paragraph unit with both an explicit style and font face.
pub fn paragraph_with_style_and_face(
id: UnitId,