Lay out inline math in paragraphs

This commit is contained in:
gloamxun committed 2026-10-24 21:13:06 +08:00
1 parent aae046a2f0
commit e008741aa5
7 files changed
+346 -13

No files matched your search

+21
View File
@@ -1270,6 +1270,27 @@ impl Unit {
}
}
/// Build a paragraph unit mixing styled runs with inline formulas.
pub fn paragraph_with_style_and_segments(
id: UnitId,
source: impl Into<String>,
style: ParagraphStyle,
segments: Vec<crate::paragraph::InlineSegment>,
) -> Self {
let source = source.into();
let paragraph = crate::paragraph::layout_paragraph_segments(&segments, &style);
Self {
id,
source,
items: vec![VerticalItem::Paragraph(paragraph)],
paragraph_style: Some(style),
paragraph_runs: None,
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,