From 4f80a7ad9e94e6539d2bb52d64fec16fd139b317 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 27 Feb 2026 17:21:20 -0500 Subject: [PATCH] fix: text bounds calculation --- graphics/src/text.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/graphics/src/text.rs b/graphics/src/text.rs index b82a289d..c5cb7178 100644 --- a/graphics/src/text.rs +++ b/graphics/src/text.rs @@ -95,8 +95,23 @@ impl Text { Text::Cached { bounds, clip_bounds, + align_y, .. - } => bounds.intersection(clip_bounds), + } => { + // XX Must account for alignment... + // Is this really how it should be handled though? + let mut bounds = *bounds; + match align_y { + alignment::Vertical::Center => { + bounds.y -= bounds.height / 2.; + } + alignment::Vertical::Bottom => { + bounds.y -= bounds.height; + } + _ => {} + }; + bounds.intersection(clip_bounds) + } Text::Raw { raw, .. } => Some(raw.clip_bounds), } }