Take xmin into account

This commit is contained in:
Gwilym Kuiper 2022-04-05 22:35:45 +01:00
parent a6f5cc9ec1
commit e7e35f8ad8

View file

@ -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];