Scale inline math proportionally

Inline math in a 12pt paragraph kept 10pt glyphs because paint_math advances
with 10pt metrics. Paint the math atom into a temporary display list at the
10pt baseline and scale that list as a unit (text sizes and positions, rule
widths/heights, line endpoints) to the paragraph size before translating it to
the baseline. The box no longer pins its size, so a scaled math glyph now
reports font-size 12.000 in a 12pt paragraph.

The twelve-point test now also asserts that an italic math glyph is rendered at
the paragraph size; the sized-paragraph test still expects a math box and no
literal dollars.
This commit is contained in:
gloamxun committed 2026-10-27 01:36:59 +08:00
1 parent b3fbbc8dda
commit 88a03ec1a1
5 files changed
+62 -17

No files matched your search

+4 -1
View File
@@ -16775,7 +16775,10 @@ left & right \\
value["warnings"]
);
let svg = value["pages"][0]["svg"].as_str().expect("svg");
assert!(svg.contains("font-style=\"italic\""), "{svg}");
let scaled_math = svg.split("<text").any(|chunk| {
chunk.contains("font-style=\"italic\"") && chunk.contains("font-size=\"12.000\"")
});
assert!(scaled_math, "math glyph was not scaled: {svg}");
assert!(!svg.contains('$'), "{svg}");
}