From 5770468740137979211b32cd11c9c1ed37ad8c01 Mon Sep 17 00:00:00 2001 From: Brent Westbrook Date: Sat, 23 Nov 2024 13:56:54 -0500 Subject: [PATCH] convert to i32 first to avoid underflow despite h and usedfont->h being unsigned, C allows the result to be negative I only caught this by running the debug build in xephyr, in release I guess something reasonable was happening automatically (probably the same as C) --- src/drw.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drw.rs b/src/drw.rs index bdd2697..fafb2da 100644 --- a/src/drw.rs +++ b/src/drw.rs @@ -569,7 +569,7 @@ pub(crate) fn text( if utf8strlen != 0 { if render != 0 { ty = y - + (h - (*usedfont).h) as i32 / 2 + + (h as i32 - (*usedfont).h as i32) / 2 + (*(*usedfont).xfont).ascent; log::trace!("text: XftDrawStringUtf8"); xft::XftDrawStringUtf8(