From 85ac47305664bc61273b578ec903636fca06ee94 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 6 Jul 2023 06:47:12 -0600 Subject: [PATCH] Fix tests --- src/edit/vi.rs | 19 +++++++++++++++---- src/layout.rs | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/edit/vi.rs b/src/edit/vi.rs index 90b87dd938..9756a29430 100644 --- a/src/edit/vi.rs +++ b/src/edit/vi.rs @@ -427,16 +427,27 @@ impl<'a> Edit for ViEditor<'a> { } for glyph in run.glyphs.iter() { - let (cache_key, x_int, y_int) = (glyph.cache_key, glyph.x_int, glyph.y_int); + let physical_glyph = glyph.physical((0., 0.), 1.0); let glyph_color = match glyph.color_opt { Some(some) => some, None => color, }; - cache.with_pixels(font_system, cache_key, glyph_color, |x, y, color| { - f(x_int + x, line_y as i32 + y_int + y, 1, 1, color); - }); + cache.with_pixels( + font_system, + physical_glyph.cache_key, + glyph_color, + |x, y, color| { + f( + physical_glyph.x + x, + line_y as i32 + physical_glyph.y + y, + 1, + 1, + color, + ); + }, + ); } } } diff --git a/src/layout.rs b/src/layout.rs index c2ff0f1f14..f25fa45584 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -72,7 +72,7 @@ impl LayoutGlyph { self.font_size * scale, ( (self.x + x_offset) * scale + offset.0, - ((self.y - y_offset) * scale + offset.1).trunc(), // Hinting in Y axis + libm::truncf((self.y - y_offset) * scale + offset.1), // Hinting in Y axis ), );