From e7e35f8ad8f3072f6b1729bc54230443894f1f34 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Tue, 5 Apr 2022 22:35:45 +0100 Subject: [PATCH] Take xmin into account --- agb/src/display/font.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agb/src/display/font.rs b/agb/src/display/font.rs index d0c5ae22..3a84a64e 100644 --- a/agb/src/display/font.rs +++ b/agb/src/display/font.rs @@ -88,9 +88,11 @@ impl Font { for c in text.chars() { let letter = self.letter(c); + let xmin = (current_x_pos + letter.xmin as i32).max(0); + for letter_y in 0..(letter.height as i32) { for letter_x in 0..(letter.width as i32) { - let x = current_x_pos + letter_x; + let x = letter_x + xmin; let y = current_y_pos + letter_y; let px = letter.data[(letter_x + letter_y * letter.width as i32) as usize];