Render inline math in sized paragraphs

Inline math returned None whenever the paragraph base size was not 10pt, so a
12pt or \large paragraph printed its dollar delimiters literally. Keep the math
segment at every size: the box width still scales with the paragraph, while the
math glyphs are pinned to the 10pt metric baseline by setting the box's size
field, so paint positions and glyph sizes stay consistent (slightly smaller
than the surrounding text, which is documented).

The old sized-paragraph test now expects a math box and no literal dollars; a
new 12pt preview test checks italic math glyphs and no "$" with no warnings.
This commit is contained in:
gloamxun committed 2026-10-27 01:34:07 +08:00
1 parent 65a132d7b1
commit b3fbbc8dda
4 files changed
+34 -16

No files matched your search

+1 -1
View File
@@ -2055,7 +2055,7 @@ pub fn layout_paragraph_segments(segments: &[InlineSegment], style: &ParagraphSt
italic: 0,
font: None,
math: Some(Box::new(atom.clone())),
size: None,
size: Some(655_360),
raise: 0,
color: None,
background: None,