From c454ef627b8d08fff2c4465da97cbb37c0cead65 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Sat, 5 Oct 2024 22:12:59 -0400 Subject: [PATCH] fix(font/sprite): avoid underflow There's a degenerate case where height < line_pos --- src/font/sprite/underline.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/font/sprite/underline.zig b/src/font/sprite/underline.zig index 3648fb976..eead4081d 100644 --- a/src/font/sprite/underline.zig +++ b/src/font/sprite/underline.zig @@ -50,7 +50,7 @@ pub fn renderGlyph( // bottom of the cell. We want the top of the glyph to be at line_pos // from the TOP of the cell, and then offset by the offset_y from the // draw function. - .offset_y = @as(i32, @intCast(height - line_pos)) - offset_y, + .offset_y = @as(i32, @intCast(height -| line_pos)) - offset_y, .atlas_x = region.x, .atlas_y = region.y, .advance_x = @floatFromInt(width),