11use crate :: utilities:: PixelGrid ;
22
33use super :: Process ;
4- use anyhow:: Result ;
4+ use anyhow:: { Error , Result } ;
55use kurbo:: BezPath ;
66use write_fonts:: tables:: glyf:: { GlyfLocaBuilder , SimpleGlyph } ;
77
@@ -21,14 +21,20 @@ pub fn push_glyf_loca_tables(process: &mut Process) -> Result<()> {
2121 process. max_pixel_height as usize - process. descender_pixels as usize - 1 ,
2222 ) ;
2323 let notdef =
24- SimpleGlyph :: from_bezpath ( & notdef. to_bezpath ( process. descender_pixels as usize ) ) . unwrap ( ) ;
24+ SimpleGlyph :: from_bezpath ( & notdef. to_bezpath ( process. descender_pixels as usize ) ?) . map_err (
25+ |x| Error :: msg ( format ! ( "{x:?}" ) )
26+ ) ?;
2527 glyf_builder. add_glyph ( & notdef) ?;
2628
27- let null_glyph = SimpleGlyph :: from_bezpath ( & BezPath :: new ( ) ) . unwrap ( ) ;
29+ let null_glyph = SimpleGlyph :: from_bezpath ( & BezPath :: new ( ) ) . map_err (
30+ |x| Error :: msg ( format ! ( "{x:?}" ) )
31+ ) ?;
2832 glyf_builder. add_glyph ( & null_glyph) ?;
2933
3034 // Glyph 2: nonmarkingreturn (empty glyph for tab/return)
31- let nonmarkingreturn = SimpleGlyph :: from_bezpath ( & BezPath :: new ( ) ) . unwrap ( ) ;
35+ let nonmarkingreturn = SimpleGlyph :: from_bezpath ( & BezPath :: new ( ) ) . map_err (
36+ |x| Error :: msg ( format ! ( "{x:?}" ) )
37+ ) ?;
3238 glyf_builder. add_glyph ( & nonmarkingreturn) ?;
3339
3440 for ( _, pixmap) in & process. pixmap_pairs {
@@ -37,15 +43,15 @@ pub fn push_glyf_loca_tables(process: &mut Process) -> Result<()> {
3743 let glyph = pixmap. clone ( ) . into_simple_glyph (
3844 process. target_pixel_size as u16 ,
3945 process. descender_pixels as usize ,
40- ) ;
46+ ) ? ;
4147 glyf_builder. add_glyph ( & glyph) ?;
4248 }
4349
4450 for pixmap in & process. color_layer_glyphs {
4551 let glyph = pixmap. clone ( ) . into_simple_glyph (
4652 process. target_pixel_size as u16 ,
4753 process. descender_pixels as usize ,
48- ) ;
54+ ) ? ;
4955 glyf_builder. add_glyph ( & glyph) ?;
5056 }
5157
0 commit comments