Scale paragraphs by their declared base font size

This commit is contained in:
gloamxun committed 2026-10-24 13:04:19 +08:00
1 parent aa4d86d735
commit 9876895a84
8 files changed
+249 -17

No files matched your search

+26
View File
@@ -6306,6 +6306,30 @@ mod tests {
assert!(svg.contains("font-style=\"italic\""));
}
#[test]
fn sized_paragraphs_paint_at_their_font_size() {
let style = crate::paragraph::ParagraphStyle {
font_size: 12 * 65_536,
..crate::paragraph::ParagraphStyle::default()
};
let unit =
Unit::paragraph_with_style_and_face(1, "large text", style, ParagraphFont::Roman);
let page = Page {
items: unit.items,
insertions: Vec::new(),
marks: Vec::new(),
floats: Vec::new(),
sources: Vec::new(),
hash: 0,
};
let list = page.display_list();
assert!(
list.items
.iter()
.any(|item| matches!(item, crate::render::DisplayItem::Text { size: 786_432, .. }))
);
}
#[test]
fn mono_paragraph_paints_with_a_mono_face() {
let unit = Unit::paragraph_with_face(1, "code 123", ParagraphFont::Mono);
@@ -6859,6 +6883,7 @@ mod tests {
width: 50,
depth: 0,
font: ParagraphFont::Roman,
font_size: 10 * 65_536,
left_skip: 0,
line_indents: vec![0; 10],
line_baselines: (0..10).map(|line| 8 + line * 10).collect(),
@@ -8433,6 +8458,7 @@ b & 2 \\
width: 5 * 65_536,
depth: 2 * 65_536,
font: ParagraphFont::Roman,
font_size: 10 * 65_536,
left_skip: 0,
line_indents: vec![0],
line_baselines: vec![8 * 65_536],