diff --git a/src/widget/text/mod.rs b/src/widget/text/mod.rs index 30de829..08208d0 100644 --- a/src/widget/text/mod.rs +++ b/src/widget/text/mod.rs @@ -89,10 +89,17 @@ impl TextView { (region, size) } - /// Wrapping reads the width it is offered, so a wider box reshapes it; a - /// taller one never does. + /// Wrapping reads the width it is offered, so a wider box reshapes it and + /// a taller one does not. Alignment matters too, and separately: glyphs + /// anchored to the start of an axis stay put when that extent changes, + /// but centred or end-aligned ones move even though the shaping stands. pub fn size_dependence(&self, axis: Axis) -> SizeDependence { - match axis == Axis::X && self.attrs.wrap { + let reshapes = axis == Axis::X && self.attrs.wrap; + let anchored = match axis { + Axis::X => self.align.x, + Axis::Y => self.align.y, + } == AxisAlign::Neg; + match reshapes || !anchored { true => SizeDependence::External, false => SizeDependence::Internal, }