fix(font/sprite): avoid underflow

There's a degenerate case where height < line_pos
This commit is contained in:
Qwerasd
2024-10-05 22:12:59 -04:00
parent fd49fb7338
commit c454ef627b

View File

@ -50,7 +50,7 @@ pub fn renderGlyph(
// bottom of the cell. We want the top of the glyph to be at line_pos // 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 // from the TOP of the cell, and then offset by the offset_y from the
// draw function. // 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_x = region.x,
.atlas_y = region.y, .atlas_y = region.y,
.advance_x = @floatFromInt(width), .advance_x = @floatFromInt(width),