From 7511f84d5d09d555698b7f5cbcef8b1f89c907ac Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:55:33 +0430 Subject: [PATCH] Layout: end manual tate-chu-yoko at soft return, and use separator metrics for empty continuation line --- crates/text/src/layout/flow.rs | 9 ++++++++- crates/text/src/layout/vertical.rs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/text/src/layout/flow.rs b/crates/text/src/layout/flow.rs index 324352060..1680d3acb 100644 --- a/crates/text/src/layout/flow.rs +++ b/crates/text/src/layout/flow.rs @@ -392,6 +392,13 @@ fn run_paragraph_lines(cx: &mut Ctx<'_>, pen: &mut Pen<'_>, t: &TextObject, mut let mut index = 0; let mut emitted_empty_continuation = false; loop { + let pm = if index >= n + && let Some(last) = paragraph.sg.last() + { + Metrics::of(last) + } else { + paragraph.pm + }; let mut placement = PlacementContext { para: paragraph.para, pr: ¶graph.pr, @@ -399,7 +406,7 @@ fn run_paragraph_lines(cx: &mut Ctx<'_>, pen: &mut Pen<'_>, t: &TextObject, mut continued: paragraph.continued, rtl: paragraph.rtl, mirror: paragraph.mirror, - pm: paragraph.pm, + pm, composed: ¶graph.composed, hyphen_run, hyphen_limit: paragraph.hyphen_limit, diff --git a/crates/text/src/layout/vertical.rs b/crates/text/src/layout/vertical.rs index 4ce9f03d8..ebc351511 100644 --- a/crates/text/src/layout/vertical.rs +++ b/crates/text/src/layout/vertical.rs @@ -23,7 +23,7 @@ pub(super) fn whole_character_widths(glyphs: &mut [SGlyph]) { /// before the automatic digit rule. /// pub(super) fn tate_chu_yoko(g: &mut [SGlyph], style: impl Fn(&SGlyph) -> (f64, bool)) { - let manual: Vec = g.iter().map(|gl| style(gl).1).collect(); + let manual: Vec = g.iter().map(|gl| gl.ch != '\u{2028}' && style(gl).1).collect(); let digits: Vec = g.iter().map(|gl| gl.inline.is_none() && gl.ch.is_ascii_digit()).collect(); let mut i = 0; while i < g.len() {