From 69278e8fdec3f728634caa37f8c6bca77fa7e29b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 18 Feb 2018 17:53:39 -0800 Subject: [PATCH] whoops, fixup width calc for single width glyphs --- src/textureatlas.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/textureatlas.rs b/src/textureatlas.rs index f8541a469..96fb14e1a 100644 --- a/src/textureatlas.rs +++ b/src/textureatlas.rs @@ -123,7 +123,7 @@ impl Sprite { /// as we work through the slices. pub fn left_pix(&self, slice: &SpriteSlice) -> u32 { let width = (self.coords.width as f32 * slice.scale) as i32; - if slice.num_cells == 0 || slice.cell_idx == 0 { + if slice.num_cells == 1 || slice.cell_idx == 0 { 0 } else { // Width of the first cell @@ -148,8 +148,8 @@ impl Sprite { pub fn slice_width(&self, slice: &SpriteSlice) -> u32 { let width = (self.coords.width as f32 * slice.scale) as i32; - if slice.num_cells == 0 { - width.saturating_sub(slice.left_offset) as u32 + if slice.num_cells == 1 { + width as u32 } else if slice.cell_idx == 0 { // The first slice can extend (or recede) to the left based // on the slice.left_offset value.