mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
fix the overflow bug on kerning / xmin on a new sprite
This commit is contained in:
parent
9ef4a8efcc
commit
53f0901ceb
|
@ -86,8 +86,12 @@ impl Preprocessor {
|
||||||
);
|
);
|
||||||
self.width_in_sprite = 0;
|
self.width_in_sprite = 0;
|
||||||
}
|
}
|
||||||
if self.width_in_sprite != 0 {
|
|
||||||
self.width_in_sprite += letter.xmin as i32;
|
self.width_in_sprite += letter.xmin as i32;
|
||||||
|
if self.width_in_sprite < 0 {
|
||||||
|
if let Some(back) = widths.back_mut() {
|
||||||
|
back.0 -= (-self.width_in_sprite).try_into().unwrap_or(0);
|
||||||
|
}
|
||||||
|
self.width_in_sprite = 0;
|
||||||
}
|
}
|
||||||
self.width_in_sprite += letter.advance_width as i32;
|
self.width_in_sprite += letter.advance_width as i32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,9 +99,8 @@ impl WordRender {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.working.x_offset != 0 {
|
|
||||||
self.working.x_offset += font_letter.xmin as i32;
|
self.working.x_offset += font_letter.xmin as i32;
|
||||||
}
|
self.working.x_offset = self.working.x_offset.max(0);
|
||||||
|
|
||||||
let y_position = font.ascent() - font_letter.height as i32 - font_letter.ymin as i32;
|
let y_position = font.ascent() - font_letter.height as i32 - font_letter.ymin as i32;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue