Fit table-cell images to their source aspect ratio
This commit is contained in:
1 parent
87a81f16cd
commit
b41a2a9a97
2 files changed
+9
-1
No files matched your search
+1
-1
@@ -150,7 +150,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
|
||||
since printpdf 0.3.4 has no annotation API.
|
||||
|
||||
- Fonts: bundled reserved-glyph subsets in `assets/fonts-subset/` are used when the document charset is covered; arXiv PDF is about 0.29 MB.
|
||||
- New-template compatibility: the SIVP class file loads fully and `sn-article.tex` previews and exports a 14-page PDF; PDF figures render as placeholders and table-cell images are embedded at fixed grid rectangles instead of becoming page-sized strips. Its journal title block captures title, author/affiliation, corresponding-author stars, both e-mails, abstract, and keywords; class declaration option leakage is consumed. The Huawei E fragment compiles to 16 A4 pages. Generic support added for TeX `\if`/`\ifx`, `\newcount`, `\newdimen`, `\char`, `tabular*`/`tabularx`, math accents/operators/arrows, a 64-bit dimension scanner, and `geometry` `text={width,height}` blocks. Both fixtures are regression tests (`sivp_project_previews_and_exports_a_pdf`, `e_fixture_compiles`).
|
||||
- New-template compatibility: the SIVP class file loads fully and `sn-article.tex` previews and exports a 14-page PDF; PDF figures render as placeholders and table-cell images are embedded at their natural aspect ratio inside the grid rectangles instead of becoming page-sized strips. Its journal title block captures title, author/affiliation, corresponding-author stars, both e-mails, abstract, and keywords; class declaration option leakage is consumed. The Huawei E fragment compiles to 16 A4 pages. Generic support added for TeX `\if`/`\ifx`, `\newcount`, `\newdimen`, `\char`, `tabular*`/`tabularx`, math accents/operators/arrows, a 64-bit dimension scanner, and `geometry` `text={width,height}` blocks. Both fixtures are regression tests (`sivp_project_previews_and_exports_a_pdf`, `e_fixture_compiles`).
|
||||
|
||||
- Lines whose justification ratio exceeds 3 fall back to natural spacing instead of stretching inter-word gaps across the measure.
|
||||
|
||||
|
||||
@@ -557,6 +557,14 @@ fn layout_table(
|
||||
&& let Some(image) = rule.image.as_mut()
|
||||
{
|
||||
*image = source_dir.join(&*image).to_string_lossy().into_owned();
|
||||
if let Ok((width, height)) = image::image_dimensions(&*image)
|
||||
&& width > 0
|
||||
{
|
||||
rule.height = common::Scaled(
|
||||
(f64::from(rule.width.0) * f64::from(height) / f64::from(width))
|
||||
.round() as i32,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user