From 842a67a667c54e065d1d8ff221923c0fe74a4cc1 Mon Sep 17 00:00:00 2001 From: Chad Brokaw Date: Thu, 14 Mar 2024 13:48:34 -0400 Subject: [PATCH] [fontc] update skrifa test to new outline API We recently removed the old scale module. Updating here now so this doesn't cause unnecessary breakage when we publish. --- fontc/src/lib.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fontc/src/lib.rs b/fontc/src/lib.rs index 994574a95..e12e3cbe6 100644 --- a/fontc/src/lib.rs +++ b/fontc/src/lib.rs @@ -504,6 +504,7 @@ mod tests { use skrifa::{ charmap::Charmap, instance::Size, + outline::DrawSettings, raw::{ tables::{ cmap::{Cmap, CmapSubtable}, @@ -514,7 +515,7 @@ mod tests { types::F2Dot14, FontData, FontRead, FontReadWithArgs, FontRef, TableProvider, }, - GlyphId, Tag, + GlyphId, MetadataProvider, Tag, }; use tempfile::{tempdir, TempDir}; use write_fonts::{ @@ -1448,19 +1449,18 @@ mod tests { let gid = Charmap::new(font).map(ch).unwrap(); let mut bp = CboxPen::new(); - let mut cx = skrifa::scale::Context::new(); - cx.new_scaler() - .size(Size::new(1000.0)) - .normalized_coords( - coords - .into_iter() - .map(F2Dot14::from_f32) - .collect::>(), + let coords = coords + .into_iter() + .map(F2Dot14::from_f32) + .collect::>(); + font.outline_glyphs() + .get(gid) + .unwrap() + .draw( + DrawSettings::unhinted(Size::new(1000.0), coords.as_slice()), + &mut bp, ) - .build(font) - .outline(gid, &mut bp) .unwrap(); - bp.cbox().unwrap() } @@ -1490,7 +1490,7 @@ mod tests { } } - impl skrifa::scale::Pen for CboxPen { + impl skrifa::outline::OutlinePen for CboxPen { fn move_to(&mut self, x: f32, y: f32) { self.last_move = Point::new(x as f64, y as f64); self.update_bounds(x, y);