From 02218dbf42492c526e7ae1369bef5967b28866cc Mon Sep 17 00:00:00 2001 From: GloamXun Date: Tue, 20 Oct 2026 02:11:24 +0800 Subject: [PATCH] Inset journal abstracts like the reference class --- src/rust_typeset/pdf/layout.rs | 8 ++++---- tests/typeset.rs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rust_typeset/pdf/layout.rs b/src/rust_typeset/pdf/layout.rs index 47e75e9..9075bef 100644 --- a/src/rust_typeset/pdf/layout.rs +++ b/src/rust_typeset/pdf/layout.rs @@ -2003,8 +2003,8 @@ pub(super) fn build_positioned_pages( } if !model.abstract_runs.is_empty() { - let abstract_width = (content_width_mm - 12.0).max(40.0); - let abstract_inset = millimeters_to_scaled(6.0); + let abstract_width = (content_width_mm - 40.0).max(40.0); + let abstract_inset = millimeters_to_scaled(20.0); let mut heading = Run::plain("Abstract".to_string()); heading.bold = true; heading.small_caps = true; @@ -2077,7 +2077,7 @@ pub(super) fn build_positioned_pages( for line in measure_positioned_lines( &runs, base_font_size.saturating_sub(1).max(1), - content_width_mm, + (content_width_mm - 40.0).max(40.0), metrics, font_cache, cjk_family, @@ -2096,7 +2096,7 @@ pub(super) fn build_positioned_pages( top_skip, max_depth, line, - millimeters_to_scaled(15.0_f64.min(content_width_mm / 4.0)), + millimeters_to_scaled(20.0_f64.min(content_width_mm / 4.0)), false, ); } diff --git a/tests/typeset.rs b/tests/typeset.rs index dc5f50d..5e5cab1 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -1976,4 +1976,6 @@ Body paragraph. "missing {needle:?} in title block: {svg}" ); } + let abstract_x = text_x(&svg, "This"); + assert!(abstract_x > 10.0, "journal abstract x={abstract_x}"); }