From ff509c2d59d6c1a497095e74d2bcc56e72661544 Mon Sep 17 00:00:00 2001 From: GloamXun Date: Mon, 19 Oct 2026 18:15:00 +0800 Subject: [PATCH] Reserve depth at the bottom of the page frame --- docs/STATUS.md | 3 +++ src/rust_typeset/pdf/layout.rs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/STATUS.md b/docs/STATUS.md index d3bf614..0386b8b 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -73,6 +73,9 @@ the source changes; the SVG preview is refreshed per page. deterministic `2014a`/`2014b` suffixes for duplicate author-year entries, indents continuation lines (plainnat hanging style), and drops numeric bibliography labels. +- Pagination: the positioned renderer reserves a 3 mm descent guard at the page + bottom (TeX `\maxdepth`) so the last baseline and its descender stay inside + the page frame. - Live preview: paragraph cache, page-hash diffing, warm rebuilds in the low milliseconds for small edits. diff --git a/src/rust_typeset/pdf/layout.rs b/src/rust_typeset/pdf/layout.rs index 0413466..efcda56 100644 --- a/src/rust_typeset/pdf/layout.rs +++ b/src/rust_typeset/pdf/layout.rs @@ -1623,7 +1623,10 @@ pub(super) fn build_positioned_pages( let max_depth = i64::from(scaled_points(ARTICLE_11PT_MAX_DEPTH_PT).0); let paragraph_gap = (normal_line_height as f64 * 0.35).round() as i64; let heading_gap = (normal_line_height as f64 * 0.65).round() as i64; - let page_goal = scaled_points(content_height_mm * PDF_POINTS_PER_INCH / 25.4).0 as i64; + // Leave a small descent guard so the last baseline and its descender stay + // inside the page frame; TeX's \maxdepth plays the same role. + let page_goal = scaled_points(content_height_mm * PDF_POINTS_PER_INCH / 25.4).0 as i64 + - millimeters_to_scaled(3.0); let mut pages = vec![PositionedPage::default()]; let mut deferred: Vec = Vec::new(); let mut block_end_pages: HashMap = HashMap::new();