Draw booktabs rules with their own weights and spans

This commit is contained in:
gloamxun committed 2026-10-24 01:03:53 +08:00
1 parent d0ffeea94b
commit c3e75bd244
5 files changed
+267 -7

No files matched your search

+18
View File
@@ -273,6 +273,15 @@ impl Halign {
};
let mut y = 0_i64;
for (row_index, row) in self.rows.iter().enumerate() {
for rule in self.rules.iter().filter(|rule| rule.row == row_index) {
let (x, width) = self.rule_rect(rule);
list.push(DisplayItem::Rule {
x,
y,
width,
height: rule.width,
});
}
if row.rule {
let height = 26_214; // 0.4pt in scaled points.
list.push(DisplayItem::Rule {
@@ -319,6 +328,15 @@ impl Halign {
}
y += row_height;
}
for rule in self.rules.iter().filter(|rule| rule.row == self.rows.len()) {
let (x, width) = self.rule_rect(rule);
list.push(DisplayItem::Rule {
x,
y,
width,
height: rule.width,
});
}
list
}
}