Lay out table-cell images as grid placeholders

This commit is contained in:
gloamxun committed 2026-10-20 02:20:59 +08:00
1 parent b1b633636a
commit 54f610445b
5 files changed
+34 -2

No files matched your search

+2
View File
@@ -431,6 +431,8 @@ pub struct RuleBox {
pub raise: common::Scaled,
/// Thickness of the rule.
pub height: common::Scaled,
/// Optional fill colour; means the regular black rule.
pub color: Option<[u8; 3]>,
}
/// Paragraph-level alignment requested by `\raggedright` or `\raggedleft`.
+16
View File
@@ -1718,6 +1718,7 @@ impl Parser {
width,
raise,
height,
color: None,
}),
box_run: None,
unresolved_reference: None,
@@ -2310,6 +2311,21 @@ impl Parser {
// ORCID icons inside \author) are dropped here.
return;
}
if let Some(table) = &mut self.table {
// Table-cell images are represented as grey boxes until the cell
// image renderer lands. This still preserves the reference grid.
let width = (0.138_f64 * 160.0 * 72.27 / 25.4 * 65536.0).round() as i32;
let height = (width as f64 * 1.35).round() as i32;
let mut run = Run::plain(String::new());
run.rule = Some(RuleBox {
width: common::Scaled(width),
raise: common::Scaled(0),
height: common::Scaled(height),
color: Some([170, 170, 170]),
});
table.cell.push(run);
return;
}
self.flush_paragraph();
if !self.figure_active {
self.figure_number += 1;