diff options
Diffstat (limited to 'font')
-rw-r--r-- | font/src/rusttype/mod.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/font/src/rusttype/mod.rs b/font/src/rusttype/mod.rs index dc64bc78..62d17de8 100644 --- a/font/src/rusttype/mod.rs +++ b/font/src/rusttype/mod.rs @@ -72,6 +72,32 @@ impl ::Rasterize for RustTypeRasterizer { } fn get_glyph(&mut self, glyph_key: GlyphKey) -> Result<RasterizedGlyph, Error> { + match glyph_key.c { + super::UNDERLINE_CURSOR_CHAR => { + let metrics = self.metrics(glyph_key.font_key, glyph_key.size)?; + return super::get_underline_cursor_glyph(metrics.descent as i32, metrics.average_advance as i32); + } + super::BEAM_CURSOR_CHAR => { + let metrics = self.metrics(glyph_key.font_key, glyph_key.size)?; + + return super::get_beam_cursor_glyph( + (metrics.line_height + f64::from(metrics.descent)).round() as i32, + metrics.line_height.round() as i32, + metrics.average_advance.round() as i32 + ); + } + super::BOX_CURSOR_CHAR => { + let metrics = self.metrics(glyph_key.font_key, glyph_key.size)?; + + return super::get_box_cursor_glyph( + (metrics.line_height + f64::from(metrics.descent)).round() as i32, + metrics.line_height.round() as i32, + metrics.average_advance.round() as i32 + ); + } + _ => () + } + let scaled_glyph = self.fonts[glyph_key.font_key.token as usize] .glyph(glyph_key.c) .ok_or(Error::MissingGlyph)? |