M7: Auto Size measures vertically aligned area type from the top

auto_height lays the text out in a very tall probe frame; with Center, Bottom
or Justify the lines moved down inside it and the frame grew to tens of
thousands of points.
This commit is contained in:
haven committed 2026-10-08 20:30:14 -07:00
1 parent abdc26d8d1
commit 53e39884fc
1 file changed
+2
+2
View File
@@ -147,6 +147,8 @@ fn auto_height(t: &mut TextObject) -> bool {
let col_w = if cols > 1 { ((b.width() - t.area.gutter.max(0.0) * (cols - 1) as f64) / cols as f64).max(1.0) } else { b.width() };
with_size(&mut probe, col_w, tall);
probe.area.columns = 1;
// Measured from the top: aligned in the tall probe the lines would sit far below.
probe.area.vertical_align = vectorcraft_doc::VerticalAlign::Top;
let lay = vectorcraft_text::layout(db, &probe);
let inset = t.area.inset.max(0.0);
let Some(bottom) = lay.lines.iter().map(|l| l.baseline + l.descent).filter(|y| y.is_finite()).reduce(f64::max) else { return false };