diff --git a/font-renderer/src/directwrite/mod.rs b/font-renderer/src/directwrite/mod.rs index 86ec3c57..9f495067 100644 --- a/font-renderer/src/directwrite/mod.rs +++ b/font-renderer/src/directwrite/mod.rs @@ -193,11 +193,14 @@ impl FontContext where FK: Clone + Hash + Eq + Ord { /// libraries (including Pathfinder) apply modifications to the outlines: for example, to /// dilate them for easier reading. To retrieve extents that account for these modifications, /// set `exact` to false. - pub fn glyph_dimensions(&self, font_instance: &FontInstance, glyph_key: &GlyphKey) - -> Option { + pub fn glyph_dimensions(&self, + font_instance: &FontInstance, + glyph_key: &GlyphKey, + _exact: bool) + -> Result { unsafe { let font_face = match self.dwrite_font_faces.get(&font_instance.font_key) { - None => return None, + None => return Err(()), Some(font_face) => (*font_face).clone(), }; @@ -206,10 +209,10 @@ impl FontContext where FK: Clone + Hash + Eq + Ord { let result = (**font_face).GetDesignGlyphMetrics(&glyph_index, 1, &mut metrics, FALSE); if !winerror::SUCCEEDED(result) { - return None + return Err(()); } - Some(GlyphDimensions { + Ok(GlyphDimensions { advance: metrics.advanceWidth as f32, origin: Point2D::new(metrics.leftSideBearing, metrics.bottomSideBearing), size: Size2D::new((metrics.rightSideBearing - metrics.leftSideBearing) as u32,