diff --git a/crates/eps/src/import/native.rs b/crates/eps/src/import/native.rs index 100fede0..e6b8edec 100644 --- a/crates/eps/src/import/native.rs +++ b/crates/eps/src/import/native.rs @@ -798,6 +798,9 @@ fn join_pieces(parts: &mut Vec>, lines: &[(String, Point)]) { && let NodeKind::Text(t) = &mut node.kind { t.runs = runs.into_iter().flatten().collect(); + // The layout cached for the first piece is not this text's. + t.cached_bounds = None; + t.cached_baselines.clear(); } let mut gone: Vec = rest.clone(); gone.sort_unstable_by(|a, b| b.cmp(a)); diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index 6fddba75..93a00a5a 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -423,6 +423,9 @@ fn a_line_the_page_draws_in_pieces_goes_to_its_text_object_whole() { let texts: Vec = group.children().unwrap().iter().filter_map(|n| if let NodeKind::Text(t) = &n.kind { Some(t.plain_text()) } else { None }).collect(); assert_eq!(texts, ["Hi there"]); + // Its bounds are laid out afresh for the whole text, not those of the first piece. + let NodeKind::Text(t) = &group.children().unwrap()[0].kind else { panic!("text") }; + assert!(t.cached_bounds.is_none() && t.cached_baselines.is_empty()); } #[test]